C# event traps triggering the "The function you are attempting to run contains macros" message !?

M

mdupris

I'm writing a C# wrapper for MS Word to run on systems where VBA is
not installed -- nor can it be (by policy). When I write event
handlers like the following:

gWordApp = new Word.ApplicationClass();
gWordAppEvents =
(Microsoft.Office.Interop.Word.ApplicationEvents2_Event)gWordApp;
gWordAppEvents.Quit += new
Microsoft.Office.Interop.Word.ApplicationEvents2_QuitEventHandler(quitWordEventHandler);

when quitting Word the "The function you are attempting to run
contains macros ..." pops up. There are no macros anywhere in the
sytem (the document, normal.dot, ....). If I drop the event handler,
the message doesn't appear and things are fine -- except for the fact
that I can't trap the events I need.

Does anyone know what's going on here, or have work-around?
 
M

mdupris

I hit the "Send" button by accident while composing the above. A more
complete version of code showing the issue is:

....
public Word.Application gWordApp;
public Microsoft.Office.Interop.Word.ApplicationEvents2_Event
gWordAppEvents;

....
gWordApp = new Word.ApplicationClass();
gWordAppEvents =
(Microsoft.Office.Interop.Word.ApplicationEvents2_Event)gWordApp;
gwordAppEvents.Quit += new
Microsoft.Office.Interop.Word.ApplicationEvents2_QuitEventHandler(quitWordEventHandler);
gWordApp.Visible = true;


private void quitWordEventHandler()
{
....
}

= M =
 
G

Guest

Hello,

Just ignore the mesasge, How ?
Here the way,
wordApp.DisplayAlerts = WdAlertLevel.wdAlertsNone;

it help me in excel application.
Hope it will help
yaron.
 

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

Similar Threads


Top