Code in ThisDocument Object Module Disappears?

J

Jim L.

Hi Everyone,

I have Word 2002 and have a user form that I'm working on. I have it
set up such that when a user clicks on a toggle button (on the active
document), it will insert a jpeg of their signature by using a stored
AutoText Entry in the template. The hang up is when a new document is
created based off the template, the code in the "ThisDocument" module
is GONE and my toggle button no longer works. The code in my module
labeled "NewMacros" is still there. Why does Word erase the code in
the "ThisDocument" object module? Is there a way to keep it? Is this
by design? I have search the Word MVP sight and these news groups and
have not found a real answer.
The Form is supposed to be intelligent... it checks who's logged
in, then adds and removes buttons in the active document accordingly.
That piecs works great and I have that in my "NewMacros" module
attached to a AutoNew() macro. The code that actually makes the
toggle button function (in the "ThisDocument" object module) appears
to be gone when a new document based off the template is created. Any
help is much appreciated.
 
J

Jim L.

Thanks J... I'll give that a shot. Thanks for your help! I tried
doing #3 and you're right... really bad idea! There's no possiblity
for version control. Thanks agian!
 
J

JB

Jim said:
Hi Everyone,

I have Word 2002 and have a user form that I'm working on. I have it
set up such that when a user clicks on a toggle button (on the active
document), it will insert a jpeg of their signature by using a stored
AutoText Entry in the template. The hang up is when a new document is
created based off the template, the code in the "ThisDocument" module
is GONE and my toggle button no longer works. The code in my module
labeled "NewMacros" is still there. Why does Word erase the code in
the "ThisDocument" object module? Is there a way to keep it? Is this
by design? I have search the Word MVP sight and these news groups and
have not found a real answer.
The Form is supposed to be intelligent... it checks who's logged
in, then adds and removes buttons in the active document accordingly.
That piecs works great and I have that in my "NewMacros" module
attached to a AutoNew() macro. The code that actually makes the
toggle button function (in the "ThisDocument" object module) appears
to be gone when a new document based off the template is created. Any
help is much appreciated.

Hi Jim,
Best thing you can do is load your template as an addin (place it in
words startup folder for the users using a login script) then you are
guaranteed that users will :-
1. have access to your template code.
2. Get the latest version of your code via login script
3. Not have loads of versions of the code in plain old documents (which
is a bad idea).

HTH

J
 

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