B
Bob Reynolds
Hello, I have a database in Excel 2003 that holds data for numerous merge
letters that I have in WORD 2003.
My scenario, that will repeat itself with about 20 different WORD letters in
mail merge format.
I have entered data into EXCEL and am now ready for the merge. I run the
following code: (Found on the web in a usergroup)
Sub OpenWordDoc()
Dim wdApp As Word.Application, wdDoc As Word.Document
On Error Resume Next
Set wdApp = GetObject(, "Word.Application")
If Err.Number <> 0 Then 'Word isn't already running
Set wdApp = CreateObject("Word.Application")
End If
On Error GoTo 0
Set wdDoc =
wdApp.Documents.Open("C:\LettersFormsCOJMaster\Letters01232007\L06Closurewithpayment01232007.dot")
'This path is fixed and will not vary.
wdApp.Visible = True
End Sub
My need is to find the template, open a new WORD document, go to the
ExcelDatabase.xls file and open the "Database" tab as the merge data source
for
the completed document. Once this is done, I need it to conduct the merge
and merge it to another document for saving or printing (selected by a
msgbox).
Any help would be appreciated. I don't want to have to direct any input
into the above process since it should be automatic. I have the same exact
scenario on the other letters,
but once I get one figured out the others will be fine. If there is better
code that would be fine also.
Thanks
Bob Reynolds.
letters that I have in WORD 2003.
My scenario, that will repeat itself with about 20 different WORD letters in
mail merge format.
I have entered data into EXCEL and am now ready for the merge. I run the
following code: (Found on the web in a usergroup)
Sub OpenWordDoc()
Dim wdApp As Word.Application, wdDoc As Word.Document
On Error Resume Next
Set wdApp = GetObject(, "Word.Application")
If Err.Number <> 0 Then 'Word isn't already running
Set wdApp = CreateObject("Word.Application")
End If
On Error GoTo 0
Set wdDoc =
wdApp.Documents.Open("C:\LettersFormsCOJMaster\Letters01232007\L06Closurewithpayment01232007.dot")
'This path is fixed and will not vary.
wdApp.Visible = True
End Sub
My need is to find the template, open a new WORD document, go to the
ExcelDatabase.xls file and open the "Database" tab as the merge data source
for
the completed document. Once this is done, I need it to conduct the merge
and merge it to another document for saving or printing (selected by a
msgbox).
Any help would be appreciated. I don't want to have to direct any input
into the above process since it should be automatic. I have the same exact
scenario on the other letters,
but once I get one figured out the others will be fine. If there is better
code that would be fine also.
Thanks
Bob Reynolds.