View Single Post
 
Old 06-16-2010, 06:02 AM
Brandi Brandi is offline Windows XP Office 2003
Novice
 
Join Date: Jun 2010
Posts: 13
Brandi is on a distinguished road
Default Macro to open template not working

I have recorded a macro to create a new document based on a template. When I use my template without the macro it opens a new document as expected and is able to use my data source.

When I use the macro to open a new document based on my template, I get the following error:
"requested object is not found" and it highlights
.Destination = wdSendToNewDocument

See complete macro below.

Sub Petition()
'
' Petition Macro
' Macro recorded 6/16/2010
'
Documents.Add Template:= _
"C:\Bergemann\Forfeiture\WordMailMerge\Petition.do t", NewTemplate:=False, _
DocumentType:=0
With ActiveDocument.MailMerge
.Destination = wdSendToNewDocument
.SuppressBlankLines = True
With .DataSource
.FirstRecord = wdDefaultFirstRecord
.LastRecord = wdDefaultLastRecord
End With
.Execute Pause:=False
End With
ActiveDocument.SaveAs FileName:="Petition.doc", FileFormat:= _
wdFormatDocument, LockComments:=False, Password:="", AddToRecentFiles:= _
True, WritePassword:="", ReadOnlyRecommended:=False, EmbedTrueTypeFonts:= _
False, SaveNativePictureFormat:=False, SaveFormsData:=False, _
SaveAsAOCELetter:=False
End Sub


Thank you.
Brandi
Reply With Quote