word 2003 VS2003 and commandbars

A

Ash

Hi,
I am writing a small com addin using C#. I can get the Word application
object from the OnConnection method fine and enumerated the COMAddIns
collection. But when I want to access any of the properties or methods of
WordApp.CommandBars I get the ExecutionEngineException error. I checked the
ToString(), GetType() methods of CommandBars object, they worked fine. The
problem seems to be in the COM methods. I ran the addin in debug mode and
could actually see all the properties from the Watch, but call to those
properties resulted in an exception. Can someone please help me regarding
this problem. Thanks in advance.
 
C

Cindy M.

Hi =?Utf-8?B?QXNo?=,
I am writing a small com addin using C#. I can get the Word application
object from the OnConnection method fine and enumerated the COMAddIns
collection. But when I want to access any of the properties or methods of
WordApp.CommandBars I get the ExecutionEngineException error. I checked the
ToString(), GetType() methods of CommandBars object, they worked fine. The
problem seems to be in the COM methods. I ran the addin in debug mode and
could actually see all the properties from the Watch, but call to those
properties resulted in an exception. Can someone please help me regarding
this problem.
As evidenced by a search on MSDN, there is no single ExecutionEngineException
error. We need the full error message to have any chance of being able to help
you.

Does you Add-in reference the Office type library, as well as the Word one?

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or reply
in the newsgroup and not by e-mail :)
 
A

Andrei Smolin

Ash,

All problems with starting the add-in development can be easily solved
with Add-in Express .NET (http://www.add-in-express.com/add-in-net/),
which includes a number of useful components, namely: CommandBar,
CommandBarControl, KeyBoardShortcut, OptionPage, as well as Word (and
Excel, Outlook, etc) event class. You drop them onto the Add-in Module
component and set their properties at design-time. If I add that we
provide at least 60 days of support, then the product becomes a
non-existing perfection. :)

Andrei Smolin
www.add-in-express.com
Add-in Express Team Leader
 
A

Ash

Hi,
Sorry for the delay. I have missed something. I get the
ExecutionEngineException when I am doing a step by step debugging. The
exception does not have any other detailed info. When I run it without
breakpoint I get a null reference exception. I can see the commandbars object
in the watch and its properties but cannot access the properties - null
reference occurs. Cindy, I am referencing the office interop and Word (PIA).

Thanks Andrei It would be nice if you have offered a trial version :)

Ash
 
A

Ash

Hi guys,
And I have been a fool!!! I solved the problem!!! I was actually referencing
both the office libraries (PIA and the other from .Net framework). And I was
even thinking of creating a custom marshaller.... But thank you guys.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top