Problem #1: Which onopen event to use in template?

K

Keith R

wrote a VBA tool to help me fill out some extensive paperwork. Now I want
to share that tool with some colleagues, but I have to make it error-free
first. Here's one problem I ran in to:

I created a template, from which I can create new documents. To make sure
it was installed correctly, when someone opens the template file itself
(like from an email or disk) it installs a copy of itself, creates a msgbox
indicating that it has copied itself to the template directory and that the
user should create a new document from [file/new] or [start/new office
document] to use it. Then the template closes itself, forcing the user to
actually open a new document and not play in the template.

Here's the problem: I used one of the on_open type events for the template
to do all this, and I think it all worked pretty well- and when I create a
new document (the first time) it works great too. The problem is when I
re-open that document I created, it triggers the event, tries to copy the
template to the template directory again, gives the same instructions on
how to create a new file, then (oops) closes the new document that I was
trying to re-open. I ended up using Ctrl-Break to stop it each time and
then end code execution, then I could keep working in the file- but my
novice users won't be up for that.

If a template is called as a reference, which (if any) events are triggered
when a child document is opened?
Or, if I have an on_open event in the template, does opening a child
document trigger it automatically, because the child is opened?
I can add something like:
if my extension = .dot
run this code
else
'nothing
endif
if it is the child that triggers it, but it'll be harder to figure out what
to do if opening a child triggers the open event(s) of a template...

any info on what is triggered when would be greatly appreciated!!
Thanks,
Keith R

Word97 on Win 95
 

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