J
jan120253
I have this code (as part of a long automation code, that simulates mailmerge by substituting bookmarks in a Word template with information from a spreadsheet):
On Error Resume Next
Set Wdapp = GetObject(, "Word.application")
If Err.Number <> 0 Then
Set Wdapp = CreateObject("Word.Application")
End If
It was made for Excel 2003, and now - after having upgraded to 2007 it does not work. If an instance of Word is already open, when I run the code, it Works as it is supposed, but if Word is not already started, it doesn't. So apparently the
Set Wdapp = CreateObject("Word.Application") par does not execute.
I have references to
Visual Basic for Applications
Microsoft Excel 12.0 Object Library
OLE Automation
Microsoft Office 12.0 Object Library
Microsoft Word 12.0 Object Library
Microsoft Office 12 Authorization Control 1.0 Type Library
Microsoft ActiveX Data Objects 2.8 Library
Microsoft ActiveX Data Objects Recordset 6.0 Library
What am I missing here?
Jan
On Error Resume Next
Set Wdapp = GetObject(, "Word.application")
If Err.Number <> 0 Then
Set Wdapp = CreateObject("Word.Application")
End If
It was made for Excel 2003, and now - after having upgraded to 2007 it does not work. If an instance of Word is already open, when I run the code, it Works as it is supposed, but if Word is not already started, it doesn't. So apparently the
Set Wdapp = CreateObject("Word.Application") par does not execute.
I have references to
Visual Basic for Applications
Microsoft Excel 12.0 Object Library
OLE Automation
Microsoft Office 12.0 Object Library
Microsoft Word 12.0 Object Library
Microsoft Office 12 Authorization Control 1.0 Type Library
Microsoft ActiveX Data Objects 2.8 Library
Microsoft ActiveX Data Objects Recordset 6.0 Library
What am I missing here?
Jan