Word Macros that work across different versions of Word

D

David Naughton

I have written a Macro that hides all the toolbars except
for a custom one that i have made. I am having problems
because Word 97 does not have all the toolbars that Word
2000 or above has. Can anyone help me to modify my macro
to close the correct toolbars for Word 97 and then if a
person is running Word 2000, skip that macro and run the
Macro for Word 2000.
 
J

Jonathan West

Hi David,

There is no magic bullet for this, you just have to thoroughly test your
code on each version of Word it has to run under. To reduce the chances of
problems, I would recommend that you develop using the oldest version of
Word, and test using newer ones. That way, you are less likely to get into
problems using keywords that simply don't exist in the older versions of
Word.

For the specifc problem yu describe, there are a number of possible
approaches I can think of.

1. You can check the value of the Application.Version property, and branch
accordingly.

2. You can iterate through the Commandbars collection, check the Name
property of each commandbar, and set its Visible property to False unless it
is your special one. This at least ensures that you only attempt to change
the state of commandbars that actually exist.
 

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