mrosvall
06-18-2004, 06:14 AM
I'm writing an application that prints all the word-documents in a folder. The application prints the documents but I would also like to have a dialog window from which the user can select a printer and access the printers settings.
Any ideas on how to accomplish this?
okie20
06-18-2004, 12:14 PM
I'm writing an application that prints all the word-documents in a folder. The application prints the documents but I would also like to have a dialog window from which the user can select a printer and access the printers settings.
Any ideas on how to accomplish this?
vb.net has a print dialog control .. have you tried that?
mrosvall
06-21-2004, 01:02 AM
Dim printController As New PrintController("Text")
dlgPrint.Document = printController.Document
If dlgPrint.ShowDialog = DialogResult.OK Then
'Print
End If
This is how I normally would do it (with printController.Document as a New PrintDocument), but this does not work when printing a word document, for example:
Dim MsWord As New Word.Application()
The code to open the desired doc and...
dlgPrint.Document = MsWord.ActiveDocument
If dlgPrint.ShowDialog = DialogResult.OK Then
'Print
End If
If I run this I just get an error message.
What should I do?
mrosvall
06-21-2004, 04:06 AM
Nevermind, I solved it myself.
Dim MsWord As New Word.Application() 'Opens WINWORD
MsWord.Visible = False 'Prevents word from appering
MsWord.Documents.Open(FileName:=currentDirectory & "\" & sDocName)
Dim dlg As Word.Dialog
dlg = MsWord.Dialogs.Item(Word.WdWordDialog.wdDialogFilePrint)
dlg.Display()
dlg.Execute()