HOWTO: Determine Application Type
by Um9iIExvcmltZXI » Fri, 15 Apr 2005 08:43:16 GMT
I tried to find this out today, but couldn't find any answered posts (it's
been asked numerous times!
In the OnConnection method:
if( application is Interop.Excel.Application )
{
MessageBox.Show("Excel Application");
}
else if( application is Interop.Access.Application )
{
MessageBox.Show("Access Application");
}
You need to reference Interop.Excel, Interop.Access and System.Windows.Forms
for this example.
--
Rob Lorimer
Extreme Systems Ltd (NZ)
RE: HOWTO: Determine Application Type
by v-phuang » Fri, 15 Apr 2005 11:18:36 GMT
Hi
Based on my test, the code below works on my side.
Have you installed the PIA?
If you are using office 2003, the PIA is shipped with office 2003
installation.
If you are using office xp, the PIA can be download via the link below.
http://www.**--****.com/
A6B4-01FEBA508E52&displaylang=en
public void OnConnection(object application,
Extensibility.ext_ConnectMode connectMode, object addInInst, ref
System.Array custom)
{
applicationObject = application;
addInInstance = addInInst;
if(application is Access.Application)
{
System.Diagnostics.Debug.WriteLine("Access.Application");
System.Windows.Forms.MessageBox.Show("Access.Application");
}
else if(application is Excel.Application)
{
System.Diagnostics.Debug.WriteLine("Excel.Application");
System.Windows.Forms.MessageBox.Show("Excel.Application");
}
}
Best regards,
Peter Huang
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
RE: HOWTO: Determine Application Type
by Um9iIExvcmltZXI » Sat, 16 Apr 2005 08:34:03 GMT
Sorry Peter,
My post was just a comment on how to do it ie I have it working and I was
telling others. The question of how to do this was asked many times with no
answer ... I was providing the answer :)
RE: HOWTO: Determine Application Type
by v-phuang » Sat, 16 Apr 2005 16:26:28 GMT
Hi
Sorry for misunderstanding your meaning. :)
Also thank for sharing the knowledge in the community.
If you still have any concern, please feel free to post here.
Best regards,
Peter Huang
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
Similar Threads:
1.Can not cast from type System.__ComObject to type Outlook.ApplicationClass an new Outlook.Application
2.HOWTO? determine selected columns in datasheet
Hi,
It is possible to determine which controls belong with the
current selected columns when a form is in datasheet view?
I already know how to get the .selleft and .selwidth, but, since columns can
be
hidden and rearranged, I don't think I can use these to figure this out.
Any help would be greatly appreciated.
Thanks,
--
Malcolm Cook - XXXX@XXXXX.COM
Database Applications Manager - Bioinformatics
Stowers Institute for Medical Research - Kansas City, MO USA
3.Howto develop VBA applications across different office versions
Hi everybody
I often need to develop, e.g. an access application, which needs to
open Word or Excel. This in it self is straight forward. However, more
often than not, the users of the database have different versions of
office installed, so the reference made to e.g. Outlook 11.0 is not
sufficient.
1) How do I develop version-independent?
2) Are Office applications all backward compatible so that I can
develop for the lowest version, and be sure that all later
versions will work for this? Then I guess, I could use
CreateObject for late-binding, or?
Thanks a lot
4.HOWTO Process button click on the client with merged Office applications
Hello.
I use MS Word server into my Outlook form.
Word replace Outlook command bars by own.
I add my CommandBar with button.
Outlook custom form code example:
'-------------------------------
'get the current command bars
Set oComBars = oWordDoc.Application.CommandBars
' add custom command bar
Set mb = oComBars.Add("My Command Bar", 1, false, true)
mb.Visible = true
'add custom button to our bar
Set btn = mb.Controls.Add
'Set properties
btn.Caption = "Click Me"
btn.BeginGroup = true
'NEEDS TO PROCESS IN OUTLLOK CODE
btn.onAction = "OnClickMe_Click"
btn.TooltipText = "Click Me!!"
btn.Style = 3
btn.FaceId = 250
btn.OLEUsage = nMSOControlOLEUsageClient ' equal 2
'---------------------------------------
When i'm clicking on my button Word catch this action, but Outlook is not
=((
Anybody knows how to process CommandButton action on the client in my case?
Thank u.
5.howto type on page when i move it to WORD
I have created stationery..other pcs need to type on it. Can I download to
WORD and still type...or where?Not everyone has Publisher
6. Determining whether the Word application has XML support
7. Determine if a document is open in Word application
8. Determine if there is an ActiveDocument in Word application