Hi all, not sure if I need to ask this in a Word forum but... I have the following code which creates a new WORD document from a mail merge WORD template (linked to a text file as data source - had problems/errors trying to link to Access query direct due to database having a password and we don't use workgroups). I have used late binding so it will work with any office version without requiring a library reference, we develop in Office 2010. This all works but I am trying to print automatically and the code I found for this (.ActiveDocument.PrintOut Background:=False) errors with 'object doesn't support this property or method'. What am I doing wrong please? Thanks
With WdApp
.DisplayAlerts = False
.Application.Visible = True
Set wdDoc = .Documents.Open(FileName:=strMainDocNm)
With wdDoc
With .MailMerge
.MainDocumentType = wdFormLetters
'OpenDataSource(Name, Format, ConfirmConversions, ReadOnly, LinkToSource, _
'AddToRecentFiles, PasswordDocument, PasswordTemplate, Revert, _
'WritePasswordDocument, WritePasswordTemplate, Connection, _
'SQLStatement, SQLStatement1, OpenExclusive, SubType)
.OpenDataSource Name:=strDataDocNm, LinkToSource:=True
.Destination = wdSendToNewDocument ' wdSendToPrinter (prints only)
.Execute
.ActiveDocument.PrintOut Background:=False
'.SaveAs SaveFolderPath & "\" & FirstLetter & "\MailMerge.doc"
.Close SaveChanges:=False
End With
End With
'.Application.Quit SaveChanges:=False
End With