Document_Open event doesn't work

R

RWN

Set up an Open event (along with a Close event) in "ThisDocument" in a
template.
Done in wd'97.

When using it in wd2k, the Open event does not fire if I create a new
document based on the template.
The close event works fine.
The Open will also work if I open it as a template.

Hints?
 
D

Doug Robbins - Word MVP

To get it to fire when a document is created from the template, you need to
use Document_New.

--
Please post any further questions or followup to the newsgroups for the
benefit of others who may be interested. Unsolicited questions forwarded
directly to me will only be answered on a paid consulting basis.

Hope this helps
Doug Robbins - Word MVP
 
R

RWN

Thanks Doug, it appears that I missed a subtle difference

The Help for "Open" states;
"If the event procedure is stored in a template, the procedure will run
when a new document based on that template is *opened* and *when the
template itself is opened as a document.*"

"New" states that "Occurs when a new document based on the template is
*created*. A procedure for the New event will run only if it is stored
in a template."

Therefore, if I want it to fire both when I open it as a template and
when I create/open it as a document I need both events in the template.
I'm not sure why this distinction is there, which means I'm missing
something.

The reason for the event is that I want to ensure that certain options
are set when a document is created/opened.
I save the user's settings on an open, set them to what the document
needs and restore them on a close (i.e.. "clean up after myself" - I
hate it when an app resets my settings and leaves them that way).
For development purposes I also want to do the same thing if it's opened
as a template.

So it appears I have to duplicate my code under a "New" and "Open" sub
(correct?).

Again, thank you.
 

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