The error occurs in here:
Application.Run "Macro2.Execute", param
...
Execute is a public sub i called from other Module "Macro2" installed in another template.
Upon run of the code:
IF there is NO open Word Document = No error
IF another instance of Word Document is open = Stated error occurs.
Is there any fix on this? :(
The whole code is below:
Dim objWord As Object
On Error Resume Next 'suppress error checking for the next instruction
Set objWord = GetObject(, "Word.Application")
If objWord Is Nothing Then
'no instance, so make a new one
Set objWord = CreateObject("Word.Application")
bNewInstance = True
End If
On Error GoTo 0 'resume error checking
'Close Document1
ActiveDocument.Close wdDoNotSaveChanges
' Open the global template
Set docAddIn = objWord.Documents.Open("C:\WordAPI\GlobalTemplate.dotm")
docAddIn.ActiveWindow.Visible = False
' Run the the public sub Execute from global template module "Macro2"
Application.Run "Macro2.Execute", param