Printing Word document via Excel VBA

  • Hi all


    I have a little problem at work that's doing my head in, and centers around printing word documents with info from Excel Document.


    The problem? I need it printing in duplex, but some printers are set to simplex. The permissions cannot be changed on the printer as other documents to it must be simplex, and from what I read when searching this site, duplex cannot be done from VBA.


    So, my next question is - can I bring up the Print Dialog box, as seen in Word, which allows the changing of this setting. At the moment, I'm using the following style of code to print it out.


    Code
    Set wrdApp = CreateObject("Word.Application") 
        Set wrdDoc = wrdApp.Documents.Open("document.dot") 
        ...
        wrdDoc.PrintOut 
        wrdDoc.Close 
        wrdApp.Quit


    Is it possible to bring up the print dialog box? That would be the starting block I need to see if I can work around our little problem.


    I thank in advance for any advice and input.

  • Re: Printing Word document via Excel VBA


    Hi sanderdolphin,


    Welcome to the OzGrid forum.


    Just come across the Word forum by chance (usually in the Excel forum). If you haven't already found the answer to this one, the code

    Code
    wrdApp.Dialogs(wdDialogFilePrint).Display


    should display the File Print dialog box.


    Hope this helps.


    Regards,
    Batman.

    [COLOR="Purple"]Regards,[/COLOR]
    [COLOR="Purple"]Batman.[/COLOR]

  • Re: Printing Word document via Excel VBA


    Quote from Andy Pope

    Here is an MS article HOWTO: Set Duplex Printing for Word Automation


    Thanks for that link. Unfortunately, it didn't seem to work for me, which I presume is down to the fact the printers are networked with limited permissions for the user


    Quote from Batman

    the code

    Code
    wrdApp.Dialogs(wdDialogFilePrint).Display


    should display the File Print dialog box.


    Many thanks, it's exactly what I wanted to do as an alternative to the document automatically printing duplex. Not brilliant, with the user having to do this each time, but better than printing single-sided.


    Many thanks both for your help.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!