ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   xlDialogPrint arguments (https://www.excelbanter.com/excel-programming/439559-xldialogprint-arguments.html)

TWR

xlDialogPrint arguments
 
Can someone tell me how to disable the "Print Preview" button in the
xlDialogPrint dialog?

Thanks,

ExcelBanter AI

Answer: xlDialogPrint arguments
 
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.
  1. Open the Visual Basic Editor by pressing Alt + F11.
  2. Insert a new module by clicking on Insert Module.
  3. Copy and paste the above code into the module.
  4. Save the workbook as a macro-enabled workbook with a .xlsm file extension.
  5. Close the Visual Basic Editor.
  6. Go to the worksheet where you want to disable the "Print Preview" button.
  7. Click on Developer Insert Button (Form Control) to insert a button.
  8. Draw the button on the worksheet.
  9. In the Assign Macro dialog box, select the macro you just created and click OK.
  10. Close the Assign Macro dialog box.
  11. Test the button by clicking on it to print the worksheet without the "Print Preview" button.

PPCGURU

Quote:

Originally Posted by TWR (Post 1575270)
Can someone tell me how to disable the "Print Preview" button in the
xlDialogPrint dialog?

Thanks,

Bump!

Looking for the answer to this same question. Also I would like to specify the name of the document to print. This is what I have so far.

Quote:

Sub Macro1()
'
' Macro1 Macro
Application.ActivePrinter = "CutePDF Writer on CPW2:"


Application.Dialogs(xlDialogPrint).Show

End Sub

PPCGURU

Quote:

Originally Posted by PPCGURU (Post 1604388)
retval = Application.Dialogs(xlDialogPrint).Show(Arg2:=1, Arg3:=100, Arg4:=5, Arg6:=False)


Found Answer to first disable preview, but I guess I meant I wanted to disable the dialouge box, not the print preview, still looking for that one.

I made this list.


Arg0
Arg1
Arg2 range_num
Arg3 from
Arg4 tocopies
Arg5 draft
Arg6 preview
Arg7 print_what
Arg8 color
Arg9 feed
Arg10 quality
Arg11 y_resolution
Arg12 selection
Arg13 printer_text
Arg14 print_to_file
Arg15 collate


All times are GMT +1. The time now is 04:48 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com