open document event

A

adi

i'm trying to catch the open event of a document (so i will know when the
wanted document is loaded) but when i sign to this event i dont get anything
from the handler. i can catch the application events but not the document.
does anyone knows how can i do it?
 
D

Doug Robbins - Word MVP

Have you tried an autoopen() macro?

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
A

adi

i'm actually new at this... so sorry for the stupid question but how do i use
this macro?
 
J

Jay Freedman

There are special macro names that are used to respond to document
events in Word. The article at
http://www.word.mvps.org/faqs/macrosvba/DocumentEvents.htm explains
what they are.

Essentially, if you name a macro AutoOpen(), and you store it in a
module in the Normal.dot template, that macro will run whenever any
document opens. Inside the macro, the code can check the name of the
document, or the name of its attached template, or anything else that
would let it identify the document. If it isn't the right document,
the macro just does an Exit Sub and nothing happens. When it is the
right document, the macro continues whatever processing is needed.

There's also the special name Document_Open(), which is similar but
goes into the ThisDocument module of the specific template on which
the document is based, instead of Normal.dot.

Finally, there's the application event handler oApp_DocumentOpen().
This is a lot harder than the others to set up properly; see
http://www.word.mvps.org/faqs/macrosvba/PseudoAutoMacros.htm and
http://www.word.mvps.org/FAQs/MacrosVBA/AppClassEvents.htm for help.

--
Regards,
Jay Freedman
Microsoft Word MVP
Email cannot be acknowledged; please post all follow-ups to the
newsgroup so all may benefit.
 
D

Doug Robbins - Word MVP

A

adi

thanks
i will check if the macros help me
the oApp.DocumentOpen() isnt helping me 'cos it is raised when the open func
is called and not when the doc is already loaded and that is what i actually
need...
 
A

adi

my main problem right now is finding an event that will be fired after
openning a doc when it finished loading all its content(so i could get the
document loading time). the open events that i found cant help me cos it
fired when the 'open' func is called before the whole doc is loaded.
does anyone have any idea how can i check this?
(by the way i'm using c# .NET)
 

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