Office COM add-in with VB .NET: Error with Word

Howard Kaikow

Member
Joined
Mar 26, 2004
Messages
21
MSFT KB article 302896 includes a step by step example demonstrating how to build an Office COM in VB .NET.

Using VB .NET 2003 Pro and Office 2003 Pro, I implemented the example and it works correctly when starting each of the following apps from the quick launch bar: Access, Excel, Outlook, Powerpoint and Word.

I then tried to open an extant Word document. I tried two docs, one already existed, the other was just created anew on the desktop.

When I double clicked on each document, I got an error message from
Microsoft Office Word. The message was:

"The command cannot be performed because a dialog box is open. Click OK, and then close open dialog boxes to continue."

This error is being caused by the display of either of two message boxes.

One msgbox is in the OnConnection method, the other is in the OnStartupComplete method.

If I comment out those two message boxes, the Word error does not occur.

This error occurs ONLY if I open an extant Word document using Windows
Explorer or on the desktop. Error does not occur if I start Word either from Start | Programs, or from the icon in the quick launch task bar.

The error does not occur with Access, Excel, or Powerpoint.

I searched MSDN and the KB and could not find the error message.

Any solutions?

It would be useful if someone could recreate the example from the KB article and let us know whether they see the same behavior,
 
Note that the error occurs even if I delete the Normal and global templates and unload a VB 6 add-in.

I guess the next step is to use another KB/MSDN article that has an example of a VB .NET COM Add-in with Word.
 
Howard,

Note that this may not solve your problem, but in my experience its much better to use template based add-ins rather than COM style add-ins. They can do just about everything a COM add-in can do, plus are MUCH easier to debug and deploy.
 
blabore said:
Howard,

Note that this may not solve your problem, but in my experience its much better to use template based add-ins rather than COM style add-ins. They can do just about everything a COM add-in can do, plus are MUCH easier to debug and deploy.

My question was specifically aimed at a particular MSFT KB article, not looking for alternative approaches.
 
Back
Top