Link to home
Start Free TrialLog in
Avatar of Boomers
Boomers

asked on

AutoExec sub and Internet Explorer

Hi,

I need to trap any save event in a Word document. I created a class and registered that class from within one of my VBAMacros.dot file stored in my startup directory as describe in the following link: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/off2000/html/wohowApplicationEvents.asp

Autoexec fires fine if I use the plain Word desktop but if it's fired from within a IE window, the Autoexec sub doesn't get fire and my class is not attached.

This could be a security issue but I would like someone's second opinion.

If this is a security issues, do you have any alternatives for the save event?

Thanks,
Boomer
Avatar of mjwills
mjwills

Have you tried the techniques listed at http://word.mvps.org/FAQs/MacrosVBA/AppClassEvents.htm ?
Avatar of Boomers

ASKER

This is exactly what I'm doing but if a document is open from within Internet Explorer, the AutoExec sub doesn't get fired. And since the Autoexec is not fired, my oApp_DocumentBeforeSave is not registered and not fired on save.

Something must be fired (like a dll) because our document management software intercept the save event from normal Word and Word within IE.

Boomer
How does the document management software work? Add-in? Something else?
Avatar of Boomers

ASKER

Well,

I finally figured this one out.

I've created a .dll that get's attached to word when word is initialized. By putting the With_Events statement in the .dll, every even from word would run throughout my .dll.

The problem with the VBA code was, as I've mentioned before that the Autoexec sub was getting executed if word was initialized from within an Internet Explorer window.

The .dll does fire the AddinInstance_OnConnection sub from normal word and from IE word.

Thanks,
Patrick
ASKER CERTIFIED SOLUTION
Avatar of CetusMOD
CetusMOD
Flag of Netherlands image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial