HOWTO: Determine Application Type

Microsoft OFFICE


  • 1. com add-in works on development machine fails in prod
    I am developing an Excel com add-in in dot net. Currently the program works on the development machines, but on a production machine the add-in is disabled. (The reigistry setting loadbehavior is being set to 2 by excel.) Surely the OnConnection event in the IDTExtensibility2 interface must be causing some problems. However there is a try catch block there which displays a message box if any error is caught. No messagebox is displayed. So it doesn't seem to be getting inside the code in the onConnection event. Is there any way to see why an addin is being disabled? TIA Julian Cropley
  • 2. Problem with multiple PowerPoint add-ins on a computer
    Hi The individual menu items of the main drop-down menu of our PowerPoint add-in stop operating when other PowerPoint add-ins are present on the computer. Is this a known problem and how can we insure that the add-in will work in the presence of other add-ins? Using Visual Studio .NET 2003 C#. Thanks, Joel
  • 3. Outlook Addin does not start
    Hello, I have an OL-Addin, written with C# VS 2003. It does not start, but I cannot find out the reason, the OL-Addin dialog only says: "Error occured". No entries written to the event log :( What can I do? Bye.

HOWTO: Determine Application Type

Postby 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

Postby v-phuang » Fri, 15 Apr 2005 11:18:36 GMT


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 
If you are using office xp, the PIA can be download via the link below.

		public void OnConnection(object application, 
Extensibility.ext_ConnectMode connectMode, object addInInst, ref 
System.Array custom)
			applicationObject = application;
			addInInstance = addInInst;
			if(application is Access.Application)
			else if(application is Excel.Application)

Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! -
This posting is provided "AS IS" with no warranties, and confers no rights.

RE: HOWTO: Determine Application Type

Postby 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

Postby v-phuang » Sat, 16 Apr 2005 16:26:28 GMT


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! -
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


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
hidden and rearranged, I don't think I can use these to figure this out.

Any help would be greatly appreciated.


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
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

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

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

Return to Microsoft OFFICE


Who is online

Users browsing this forum: No registered users and 88 guest