Template Problem

A

anon

Hi All,

I wrote a template that has the 'autonew' function and a userform, the
results of which are placed into the new document at locations denoted
by bookmarks using lines such as this:
..Bookmarks("ClientContact").Range.InsertBefore ClientContact

The code ends with:

UserForm1.Hide
End Sub


The template was originally written in word 98. Now, in Word X, after
the userform is hidden and all the info is in place, whenever I hit
enter/return, Word inserts all the info from the userform again. I've
rewritten the code (several times) with the same result.

The oddest part is that the template works fine when I make any change
to it at all as long as I don't quit Word. The problem only happens
after I restart the application. Almost like Word is writing something
to the template on shutdown.

Any insights?

Thanks for your time!

Nat
 
J

John McGhie

I'm a little unclear as to what you actually say the fault is. Are you
saying that the bookmarks are being filled a second time? Are you doing
anything with the Protect Document function? That can cause userforms to
play up.

Have you checked your userform code for the presence of event handlers such
as an OnExit on one of the fields?

If you care to post your whole code here, I will ask one of the VBA experts
down the hallway to look over it for you.

Yes, Word is indeed writing all sorts of things into Normal template: it
does this all the time. However, that should not affect the operation of
your VBA.

Cheers


Hi All,

I wrote a template that has the 'autonew' function and a userform, the
results of which are placed into the new document at locations denoted
by bookmarks using lines such as this:
.Bookmarks("ClientContact").Range.InsertBefore ClientContact


The code ends with:

UserForm1.Hide
End Sub


The template was originally written in word 98. Now, in Word X, after
the userform is hidden and all the info is in place, whenever I hit
enter/return, Word inserts all the info from the userform again. I've
rewritten the code (several times) with the same result.

The oddest part is that the template works fine when I make any change
to it at all as long as I don't quit Word. The problem only happens
after I restart the application. Almost like Word is writing something
to the template on shutdown.

Any insights?

Thanks for your time!

Nat

--

Please reply to the newsgroup to maintain the thread. Please do not email
me unless I ask you to.

John McGhie <[email protected]>
Consultant Technical Writer
Sydney, Australia +61 4 1209 1410
 

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