在word2003的vba中,使用activeprinter属性会设置系统默认打印机。
于是我就参照http://support.microsoft.com/kb/209722/zh-cn,
Sub ChangePrinter()
Dim sCurPrinter As String
With Application
sCurPrinter = .ActivePrinter ' Store current printer.
.ActivePrinter = "HP LaserJet 4SI" ' Change Printers.
ActiveDocument.PrintOut ' Print the active document.
.ActivePrinter = sCurPrinter ' Set printer back to current.
End With
End Sub
写了一个打印程序。
但是后来我又发现http://support.microsoft.com/kb/216026/zh-cn,中的
Set oWord = CreateObject("Word.Application")
oWord.WordBasic.FilePrintSetup Printer:="HP LaserJet 4SI", _
DoNotSetAsSysDefault:=1
但是这段代码设置不了打印机。请问有没有类似第二种办法来改变打印机的设置?