I am attaching my template Petition.dot and also the data source which is one table in an Access database. Maybe you can see what might be wrong. Every time I record a macro and try to run it, it tells me the "requested object is not available" and is not finding the data source.
If I manually double click Petition.dot, then it says it is going to run the SQL and finds the data source. When I click Merge to New document, it wants to save the connection to the data source.
Here is my macro:
Sub Test()
'
' Test Macro
' Macro recorded 6/15/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
Windows("Letters1").Activate
End Sub
Thank you.
Brandi
|