macro moving with document

L

lots of questions

How can you ensure that a macro created and saved in a Word2003 template is
operable by the user? I know that macro security settings can affect macro
functionality and have accounted for this.

I develop electronic forms using Word2003. The templates (.dot) are stored
on the company server and accessible to employees thru a tab added to the
'file-new' window.

Sometimes I write code using the VB Editor in the file template I am
developing. Other times I use the Macro Recorder to capture a sequence of
events.
Whichever way I create a macro - I make sure it is being saved in the
template and not normal. Depending upon the form, I will assign the macro to
a button or menu or a keyboard combination.....I 'test drive' the form on my
system before placing out on the server....the problem - about half the time
the button/menu or key combination works fine on my computer but when I email
the template to the requestor of the template for review, the code is not
functional. If I go the the individuals computer and open the file, the code
is there in the vb editor, just not working. If I re-establish the button or
keyboard connectivity and run the code, it works, however, if the employee
closes the file and reopens it, it might or might not work. Accessibility
also seems to depend on whether the code is in 'newmacros' or 'thisdocument'
.. I've read thru a number of the threads here on the site but don't get
in-depth answers as to where the code 'should be'. Can someone provide a
clarification or direct me to specific articles or books where I can find the
information? Much thanks
 
C

Charles Kenyon

The code _and the menu customizations_ should be in the template.

When you say the code is not working, have you tested it in the vb editor by
pressing the F5 key and running the code?
--
Charles Kenyon

Word New User FAQ & Web Directory: http://addbalance.com/word

Intermediate User's Guide to Microsoft Word (supplemented version of
Microsoft's Legal Users' Guide) http://addbalance.com/usersguide


--------- --------- --------- --------- --------- ---------
This message is posted to a newsgroup. Please post replies
and questions to the newsgroup so that others can learn
from my ignorance and your wisdom.
 
T

Tony Jollans

When you say "the code is not functional" I think you mean that it doesn't
run in response to the shortcut.

Are you sure you are saving the customization in the template and that it
correctly refers to the macro in the template.

Before you 're-establish' the shortcut, what is it set to?
 
L

lots of questions

Tony/Charles:
I do run the macro in the editor before saving the document to make sure its
running properly.....what I'm finding confusing is this: if I record a macro
with the recorder, it is stored under "new macros", if I write the macro in
the editor, by default, it gets stored under "this document". Does it matter
where the macro is stored within the template? This 'master template' (.dot)
is then moved into a folder on the network where the employees have access
thru Word, file new.

When I save the macro under a 'button', making sure it is not saved to the
normal.dot, and place the button in the 'standard menu', it does not always
appear, either in the standard menu or anywhere visible, when the employee
accesses it from the network. Key combinations are more reliable, but I
don't understand whats going on.....any ideas?
 
W

Word Heretic

G'day "lots of questions" <[email protected]>,

You shouldnt write code in the This_Document container unless it is
specifically related to the events in there. Open the Modules of the
project and use the provided module in the there.


Steve Hudson - Word Heretic

steve from wordheretic.com (Email replies require payment)
Without prejudice


lots of questions reckoned:
 
C

Charles Kenyon

When I want to access a macro I write from the user interface (i.e. attach
it to a button or find it in the macros menu) I put it in a module. If
appropriate, I insert a new module and give it a useful name. I don't write
code to NewMacros and tend to move code out of NewMacros to an appropriately
named module. If you move code from one spot to another after creating a
toolbar button or menu item to call the procedure, you'll break the link
between the two and need to recreate your customization.

For toolbar/menu customizations to built-in toolbars or menus, I create a
custom toolbar and build my button or menu item on that toolbar. Then I copy
it to the built-in toolbar. I make sure when I do both that the save in box
shows my template name. Creating a custom toolbar makes it much easier to
copy customizations.
--
Charles Kenyon

Word New User FAQ & Web Directory: http://addbalance.com/word

Intermediate User's Guide to Microsoft Word (supplemented version of
Microsoft's Legal Users' Guide) http://addbalance.com/usersguide


--------- --------- --------- --------- --------- ---------
This message is posted to a newsgroup. Please post replies
and questions to the newsgroup so that others can learn
from my ignorance and your wisdom.
 

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