I have a VBScript that creates a new document from a teplate (.dot) and inserts data from another application. When the data has been inserted I want to run the macro that protects the document(allow only forms). It is working when the macro exists in the wordtemplate. If I want to open another template I get an error message because the macro does not exist. How can I make the script to run only if the macro exists in the word template? My code for running macro:
WordApp.Run("ProtectDocument")
WordApp.Run("ProtectDocument")