Newbie: how to use vba to install a word macro on other machines?

F

Frank

I want to write a vba macro in a word document that can be distributed to
other Word users. This macro should create a new macro (see below) in the
normal.dot template and create a macro command entry on the Formatting
toolbar.

How is this done?

Regards
Frank Krogh

________________



' AdjustTables Macro
Application.ScreenUpdating = False
For Each aTable In ActiveDocument.Tables
aTable.AutoFitBehavior (wdAutoFitContent)
Next aTable
Application.ScreenUpdating = True
End Sub
 
S

Shauna Kelly

Hi Frank

I suggest you re-think your proposed method of distributing the macro to
other users. I suggest that you:

1. Use File > New and create a new template (not document).

2. Copy your code into that new template.

3. With your template open, use Tools > Customize. On the Commands tab, make
sure that the Save In box refers to your template. Add the button to the
Formatting toolbar that will run your macro.

4. Save it in your Word startup folder (it's given at Tools > Options > File
Locations, and is probably C:\Documents and Settings\<user name>\Application
Data\Microsoft\Word\STARTUP).

5. Assuming that you have a very small number of users, then email the file
to your users and tell them to save it to their Word startup folder (like
yours, probably C:\Documents and Settings\<user name>\Application
Data\Microsoft\Word\STARTUP).

Now, when each user starts Word, your template will load as an add-in, your
toolbar menu will be available and it will run your macro.

More info at
Distributing macros to other users
http://www.word.mvps.org/FAQs/MacrosVBA/DistributeMacros.htm

Hope this helps.

Shauna Kelly. Microsoft MVP.
http://www.shaunakelly.com/word
 

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