How to open a merged word document

  • Thread starter Thread starter Tonja
  • Start date Start date
T

Tonja

Please help me to write a macro that would allow me open a
merged word doc. from Excel. The document already has a
datasource. Is this possible? Please help soon.

Thanks.
 
Here are a couple of macros that should help.

Sub openxmas()
Dim appWD As Object
Dim wdDoc As Document
Set appWD = CreateObject("Word.Application")
appWD.Visible = True
appWD.ChangeFileOpenDirectory ActiveWorkbook.Path
appWD.Documents.Open Filename:="XmasListEnvelopes.doc"
Set wdDoc = appWD.ActiveDocument
End Sub

Sub OpenDocument()
Dim wdApp As Word.Application
strFilename = "XmasListEnvelopes1.doc"
Set wdApp = CreateObject("Word.Application")
With wdApp
.Documents.Open Filename:=ThisWorkbook.Path & "\" & strFilename
.Visible = True
End With
Set wdApp = Nothing
End Sub
 
Thank you very much.
-----Original Message-----
Here are a couple of macros that should help.

Sub openxmas()
Dim appWD As Object
Dim wdDoc As Document
Set appWD = CreateObject("Word.Application")
appWD.Visible = True
appWD.ChangeFileOpenDirectory ActiveWorkbook.Path
appWD.Documents.Open Filename:="XmasListEnvelopes.doc"
Set wdDoc = appWD.ActiveDocument
End Sub

Sub OpenDocument()
Dim wdApp As Word.Application
strFilename = "XmasListEnvelopes1.doc"
Set wdApp = CreateObject("Word.Application")
With wdApp
.Documents.Open Filename:=ThisWorkbook.Path & "\" & strFilename
.Visible = True
End With
Set wdApp = Nothing
End Sub

--
Don Guillett
SalesAid Software
(e-mail address removed)



.
 
Back
Top