Yes, you can disable the "Print Preview" button in the xlDialogPrint dialog by using the following VBA code:
Formula:
Sub DisablePrintPreviewButton()
Application.Dialogs(xlDialogPrint).Show arg1:=False
End Sub
This code will open the xlDialogPrint dialog without the "Print Preview" button. The
arg1:=False argument disables the "Print Preview" button.
You can assign this macro to a button or a keyboard shortcut to quickly print your worksheet without having to go through the print preview screen.
- Open the Visual Basic Editor by pressing Alt + F11.
- Insert a new module by clicking on Insert Module.
- Copy and paste the above code into the module.
- Save the workbook as a macro-enabled workbook with a .xlsm file extension.
- Close the Visual Basic Editor.
- Go to the worksheet where you want to disable the "Print Preview" button.
- Click on Developer Insert Button (Form Control) to insert a button.
- Draw the button on the worksheet.
- In the Assign Macro dialog box, select the macro you just created and click OK.
- Close the Assign Macro dialog box.
- Test the button by clicking on it to print the worksheet without the "Print Preview" button.