MrExcel Publishing
Your One Stop for Excel Tips & Solutions

xlDialogPrint Show option to "Gray out" button

Posted by Rick Eckstein on November 06, 2001 12:53 PM

I am working on a VBA Excel program that has a form that has a print button. The button code is "Application.Dialogs(xlDialogPrint).Show" but I need to "disable" the Print preview button on this dialog box. Help shows me that "perview" is number six in the augument list but does not show how to make it false???

What does the code look like to do this?

Posted by Jack on November 06, 2001 10:46 PM

Sometimes i recorde snips of code if i cant get the syntax exact, try and see if Excel gives up its secret!

Posted by Rick on November 07, 2001 5:44 AM

Thanks Jack but that was no help to me!

Posted by Joe Was on November 07, 2001 12:10 PM

This will Deactivate the "Preview" Property and show the print box.

Application.Dialogs(xlDialogPrint).Show (preview = False)

The Print Dialog Box will open the preview button will be visible and appear to be active but if the user clicks it nothing will happen.

You may try to set the button font color to gray by trapping the color index or use the xlDialogPushButtonProperties with one of the xlEditColor type Dialogs on the preview property?

I tested the "preview property" and it works when set to False in Excel 2000 but did not try the color reset, as the above code did turn off the preview button. Joe Was