PC Review


Reply
Thread Tools Rate Thread

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

 
 
mdupris@hotmail.com
Guest
Posts: n/a
 
      14th Aug 2007
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?

 
Reply With Quote
 
 
 
 
mdupris@hotmail.com
Guest
Posts: n/a
 
      14th Aug 2007
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 =


On Aug 14, 2:05 pm, mdup...@hotmail.com wrote:
> 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(quitWordE*ventHandler);
>
> 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?



 
Reply With Quote
 
=?Utf-8?B?VGVtcGxhdGUgaGllcmFyY2h5IGFuZCBjdXN0b21p
Guest
Posts: n/a
 
      15th Aug 2007
Hello,

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

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

"(E-Mail Removed)" wrote:

> 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 =
>
>
> On Aug 14, 2:05 pm, mdup...@hotmail.com wrote:
> > 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(quitWordE-ventHandler);
> >
> > 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?

>
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Message: "Can't create file" while attempting to open attachment withspecific name mcbill20@yahoo.com Microsoft Outlook Discussion 8 14th Dec 2007 02:23 PM
"Frontpage " message appears on attempting to open excel =?Utf-8?B?c3Rld2FydCByZWlk?= Microsoft Excel Misc 1 14th Sep 2005 04:32 PM
"message text for users attempting to log on" not working =?Utf-8?B?SlIgVHJlbnQ=?= Microsoft Windows 2000 Group Policy 4 19th Jan 2005 01:44 PM
"Another software is attempting to access my contact list" message block306 Microsoft Outlook 1 28th Aug 2004 02:39 PM
attempting motherboard change get "ntldr missing" message dennis Microsoft Windows 2000 Upgrade 2 9th Dec 2003 06:16 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:35 AM.