HELP Needed, Word mail merge breaks when saved as.. from an Excel Macro

G

GastonFranzini

I need some help, I have an excel Macro that opens a word File. This
Word file has some Merged Fields, when I save it with a different name
all the merged fields brake.
Is there a way of updating the word File.
I paste the code downwards if you can suggest any improvement.
Thanks
-------------------------------------------------------------------
Sub wordchage()

Dim WordApp As Object
Set WordApp = CreateObject("Word.Application")

fpath = ThisWorkbook.Path
Doc = fpath & "\" & ("Base booklet.doc")
Sheets("Incumbent").Select
LetterTemplate = Doc
fname = Range("A3")
fnamedoc = fname & ".doc"

With WordApp
..Documents.Open LetterTemplate
..Visible = False
End With

Application.DisplayAlerts = True
WordApp.ActiveDocument.SaveAs Filename:=fpath & "\" & fnamedoc
WordApp.PrintOut Background:=False ' Prints in PDF - named argument
Filename:= not working
WordApp.NormalTemplate.Saved = True
WordApp.ActiveDocument.Close

Set WordApp = Nothing
Set Doc = Nothing

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top