PDA

View Full Version : Calling Macros in Word



RECrerar
08-07-2007, 04:08 AM
Hi I have been using VBA in Excel for a few weeks with no problems. I have recently needed to write a macro in word to automatically convert a .doc file to a .txt file. The macro itself works fine my problem is this:

I have the macro saved in a module of an open document. The document I want to convert is open and the active document. I select Alt F8 to bring the list of available macros and my macro does not appear in the list (I do have the list selected to 'all active templates and documents'). Why does it not appear in the list? and How can I get it to appear?

If I have the code in a module in the 'Normal' file it is visible and can be execute, however I do not want to have it here as eventually it will need to be available across a network and hence be saved in a file that can be opened from any of the network computers.

Finally, I will eventually want this program as an Add-In, is this possible within word?

fumei
08-07-2007, 07:06 AM
Finally, I will eventually want this program as an Add-In, is this possible within word?This is actually one and the same with your earlier question.

Put your code in a global template. This can be loaded automatically OR loaded dynamically. In either case code will be available to all documents. A global can be on a network folder.

RECrerar
08-07-2007, 08:14 AM
Hi,

Okay so the first part of my problem was a marco security level issue. Sorry just assumed it would be at the same level in Excel and Word - foolish.

As to the Add-Ins, what I meant by that question is that (in the VBE)within This document - properties there does not appear to be a "Is Add-In" Property. In Excel you simply set this to True if you wish the program to be an Add-In and Flase if you do not. Is this possible within word? If so how?

fumei
08-09-2007, 04:47 PM
You make an Addin available by using Tools > Templates and Add-ins, from Word menu. Browse to the .dot file and add it to the add-ins available.

This can be done manually, as above, programatically via code), or automatically. To load it automatically, you put the .dot file in the Word Startup folder.

The file must exist to use as an addin.

I am not an Excel person, and i just looked at the IsAddin property. I am not sure where and why you would use this. No doubt there IS a reason, I just don't understand it. It seems dynamic to me.

Word add-ins are not dynamic in the same sense. They are either loaded...or they are not loaded. And again, they are files.