您好,我希望在从VB程序打印时使用打印对话框。我正在尝试打印Word文档,我可以成功打印一个文档,但是如果我在打印对话框中指定了多个文档,那么打印机仍然只能打印一个。我只需要能够选择我想要打印的文档数量。 感谢
以下是相关按钮的代码:
Private Sub Button19_Click(sender As Object, e As EventArgs) Handles Button19.Click
Dim f As New OpenFileDialog
Dim p As New PrintDialog
Dim app As Word.Application
Dim doc As Word.Document
'Open file and print dialogs to get desired document and printer
If p.ShowDialog = Windows.Forms.DialogResult.OK Then
'Create instance of Word Application
app = New Word.Application
'Set Printer
app.WordBasic.FilePrintSetup(Printer:=p.PrinterSettings.PrinterName, DoNotSetAsSysDefault:=1)
'Set filename to object type
Dim filename As Object = f.FileName
Dim m As Object = System.Reflection.Missing.Value
'Open document
doc = app.Documents.Open("C:\CamJam\Tickets\Monday\drivingrange_mon_pm.docx")
'Print document
app.PrintOut()
'Close document
app.Documents.Close()
'Quit word application
app.Quit()
'Release
app = Nothing
End If
End Sub