For Excel use the following:
Code:
Set xlApp = CreateObject("Excel.Application")
xlApp.Visible = True
DoEvents 'Pause until everything previously has been process
' PURPOSE:Technique to run a macro in another Microsoft Application
' Another technique would be sticking the pBrain macro into the "Open" event
xlApp.Workbooks.Open FileName:=gstrTemplateDirectory & "FormatText.xls"
xlApp.Run "FormatText.xls" & "!pBrain"
For Word use the following:
Code:
Set xlApp = CreateObject("Word.Application")
xlApp.Visible = True
DoEvents 'Pause until everything previously has been process
' PURPOSE:Technique to run a macro in another Microsoft Application
' Another technique would be sticking the pBrain
' macro in "Macro.doc" into the "Open" event
xlApp.Documents.Open FileName:=gstrTemplateDirectory & "Macro.doc", PasswordDocument:="Testing"
' PURPOSE: Call this macro
xlApp.Run MacroName:="pBrain"