Share via

vb .net Print without print Dialog

Vasiliki Konstanti 1 Reputation point
2022-12-20T10:04:11.63+00:00

i am trying to Print the currently active Document BUT i dont want the PrintDialog to pop-Up and i want to define my own Default printing Settings. Is there a way to that?

i tried using :

ActiveDocument.PrintOut(
Background:=True,
Append:=False,
Range:=Word.WdPrintOutRange.wdPrintAllDocument,
Item:=Word.WdPrintOutItem.wdPrintDocumentContent,
Copies:="3",
Pages:="1-3",
PageType:=Word.WdPrintOutPages.wdPrintAllPages,
PrintToFile:=False,
Collate:=True,
ManualDuplexPrint:=False)
And:

'PrintOut()

And

Application.Dialogs(Microsoft.Office.Interop.Word.WdWordDialog.wdDialogFilePrint).Execute()
but there dont quite exactly deal with my problem.
(vb .net Print Active Document without PrintDialog and set new default settings for printer)

Windows for business | Windows Server | User experience | Print jobs
Developer technologies | VB
{count} votes

2 answers

Sort by: Most helpful
  1. Jiachen Li-MSFT 34,241 Reputation points Microsoft External Staff
    2022-12-23T08:59:02.76+00:00

    Hi @Vasiliki Konstanti ,
    You can use Document.PrintOut() method to print the current document.
    Set parameters for the Document.PrintOut() method to achieve the print you want.
    For more details about the parameters, you can refer to the following links.
    How to: Programmatically print documents
    Document.PrintOut method (Word)
    Best Regards.
    Jiachen Li

    ----------

    If the answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


  2. Limitless Technology 45,181 Reputation points
    2022-12-21T08:56:37.06+00:00

    Hi,

    Thank you for posting your query.

    Kindly follow the steps provided below to resolve your issue.

    Dim m_PrintDocument = New Printing.PrintDocument

    Dim printControl = New Printing.StandardPrintController

    m_PrintDocument.PrintController = printControl

    m_PrintDocument.Print()

    It will Work fine. It will not Display PrintDialog, it send the print Directly to the printer.

    Go to this link for your reference and other troubleshooting procedures https://social.msdn.microsoft.com/Forums/vstudio/en-US/f8688005-cd30-49b8-826c-3fc5d597abb8/how-to-hide-print-dialog-while-printing-a-document-from-vbnet-application-?forum=vsto

    Do not hesitate to message us if you need further assistance.

    If the answer is helpful kindly click "Accept as Answer" and up vote it.


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.