ChrisCalvert
Technical User
I am looking for a bit of code to insert in the code below to select a different printer from the default printer listed in the 'Printers' control panel dialog. I am trying to get this to work with
objWord.application.activeprinter
but am having some problems...
Here is the code:
Public Function DoTermMerge()
Dim objWord As Word.Document
Set objWord = GetObject("R:\Termination.doc", "Word.Document"
' Make Word visible.
objWord.Application.Visible = True
' Set the mail merge data source
objWord.mailmerge.OpenDataSource _
Name:="R:\Fulfilment.mdb", _
LinkToSource:=True, _
Connection:="TABLE Termination", _
SQLStatement:="SELECT * FROM [Termination]"
objWord.mailmerge.Destination = wdSendToNewDocument
objWord.mailmerge.Execute
'The following line must follow the Execute statement because the
'PrintBackground property is available only when a document window is
'active. Without this line of code, the function will end before Word
'can print the merged document.
objWord.Application.Options.PrintBackground = False
' hoping for helpful code here
objWord.Application.ActiveDocument.PrintOut
objWord.Application.ActiveDocument.Close (wdDoNotSaveChanges)
objWord.Application.Quit (wdDoNotSaveChanges)
Set objWord = Nothing 'clears object instance from memory
End Function
objWord.application.activeprinter
but am having some problems...
Here is the code:
Public Function DoTermMerge()
Dim objWord As Word.Document
Set objWord = GetObject("R:\Termination.doc", "Word.Document"
' Make Word visible.
objWord.Application.Visible = True
' Set the mail merge data source
objWord.mailmerge.OpenDataSource _
Name:="R:\Fulfilment.mdb", _
LinkToSource:=True, _
Connection:="TABLE Termination", _
SQLStatement:="SELECT * FROM [Termination]"
objWord.mailmerge.Destination = wdSendToNewDocument
objWord.mailmerge.Execute
'The following line must follow the Execute statement because the
'PrintBackground property is available only when a document window is
'active. Without this line of code, the function will end before Word
'can print the merged document.
objWord.Application.Options.PrintBackground = False
' hoping for helpful code here
objWord.Application.ActiveDocument.PrintOut
objWord.Application.ActiveDocument.Close (wdDoNotSaveChanges)
objWord.Application.Quit (wdDoNotSaveChanges)
Set objWord = Nothing 'clears object instance from memory
End Function