none
How to display Word's Print dialog? RRS feed

  • Question

  • The dialog I want is the one that appears when you click Ctrl-P in a Word document.

    Robert Homes

    Monday, July 13, 2015 2:21 PM

Answers

  • Hi Robert,

    For this requirement, you could use SendKeys Statement to achieve that.

    SendKeys "^p"

    On the other hand, we can use Dialogs method to show print dialog, for example:

    Dialogs(wdDialogFilePrint).Show

    Regards

    Starain


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    • Marked as answer by Robert Homes Tuesday, July 14, 2015 2:18 PM
    Tuesday, July 14, 2015 5:21 AM
    Moderator
  • Hi Robert

    It depends very much on which version of Word we're discussing?

    I get the impression we're talking about a version where the Print UI is in the Backstage view? In that case, try:

    WordApplication.CommandBars.ExecuteMso("PrintPreviewAndPrint")


    Cindy Meister, VSTO/Word MVP, my blog

    • Marked as answer by Robert Homes Tuesday, July 14, 2015 2:18 PM
    Tuesday, July 14, 2015 1:51 PM
    Moderator

All replies

  • Hi Robert,

    For this requirement, you could use SendKeys Statement to achieve that.

    SendKeys "^p"

    On the other hand, we can use Dialogs method to show print dialog, for example:

    Dialogs(wdDialogFilePrint).Show

    Regards

    Starain


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    • Marked as answer by Robert Homes Tuesday, July 14, 2015 2:18 PM
    Tuesday, July 14, 2015 5:21 AM
    Moderator
  •  you could use SendKeys 

    Does that mean that there really is no way (other than Sendkeys) to programmatically raise Word's PrintPreview dialog?

    Dialogs(wdDialogFilePrint).Show

    That isn't the same as Word PrintPreview dialog. It will do the job, but in a denser way.


    Robert Homes

    Tuesday, July 14, 2015 11:35 AM
  • Hi Robert

    It depends very much on which version of Word we're discussing?

    I get the impression we're talking about a version where the Print UI is in the Backstage view? In that case, try:

    WordApplication.CommandBars.ExecuteMso("PrintPreviewAndPrint")


    Cindy Meister, VSTO/Word MVP, my blog

    • Marked as answer by Robert Homes Tuesday, July 14, 2015 2:18 PM
    Tuesday, July 14, 2015 1:51 PM
    Moderator
  • Cindy:

    This raises the question I've been thinking about for awhile now -- I think my program should try to know which version the user is using! How do you do that?

    (In view of that issue, maybe SendKeys.send("^p") IS the best answer, for now.)


    Robert Homes

    Tuesday, July 14, 2015 2:20 PM
  • Hi Robert

    Which version? That's fairly simple :-)

    WordApplication.Version

    returns a string with something like 15.0, 10.0... whatever. (Except there's no 13 - that was skipped!)


    Cindy Meister, VSTO/Word MVP, my blog

    Tuesday, July 14, 2015 3:27 PM
    Moderator