ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   XLDialogPrint - PrintWhat- Selection Option (https://www.excelbanter.com/excel-programming/383249-xldialogprint-printwhat-selection-option.html)

TonyD

XLDialogPrint - PrintWhat- Selection Option
 
Is there any way that I can make the windows printer dialogue box appear and
select the option "Selection" automatically in the "Print_What" area? I tried
the following but it doesn't select "Selection" and when I try to print it
keeps coming back.

Application.Dialogs(xlDialogPrint).Show ,,,,,,selection



Tom Ogilvy

XLDialogPrint - PrintWhat- Selection Option
 
Sub AABB()
res = Application.Dialogs( _
xlDialogPrint).Show(, , , , , , , , , , , 1)
End Sub

worked for me.

--
Regards,
Tom Ogilvy



"TonyD" wrote:

Is there any way that I can make the windows printer dialogue box appear and
select the option "Selection" automatically in the "Print_What" area? I tried
the following but it doesn't select "Selection" and when I try to print it
keeps coming back.

Application.Dialogs(xlDialogPrint).Show ,,,,,,selection



TonyD

XLDialogPrint - PrintWhat- Selection Option
 
Thanks Tom it worked fine.

How do I rate responses to my questions?

"Tom Ogilvy" wrote:

Sub AABB()
res = Application.Dialogs( _
xlDialogPrint).Show(, , , , , , , , , , , 1)
End Sub

worked for me.

--
Regards,
Tom Ogilvy



"TonyD" wrote:

Is there any way that I can make the windows printer dialogue box appear and
select the option "Selection" automatically in the "Print_What" area? I tried
the following but it doesn't select "Selection" and when I try to print it
keeps coming back.

Application.Dialogs(xlDialogPrint).Show ,,,,,,selection



Tom Ogilvy

XLDialogPrint - PrintWhat- Selection Option
 
You just select my answer and click on the two button over on the right.

--
Regards,
Tom Ogilvy


"TonyD" wrote in message
...
Thanks Tom it worked fine.

How do I rate responses to my questions?

"Tom Ogilvy" wrote:

Sub AABB()
res = Application.Dialogs( _
xlDialogPrint).Show(, , , , , , , , , , , 1)
End Sub

worked for me.

--
Regards,
Tom Ogilvy



"TonyD" wrote:

Is there any way that I can make the windows printer dialogue box
appear and
select the option "Selection" automatically in the "Print_What" area? I
tried
the following but it doesn't select "Selection" and when I try to print
it
keeps coming back.

Application.Dialogs(xlDialogPrint).Show ,,,,,,selection





pstraton

Quote:

Originally Posted by TonyD (Post 1354257)
Is there any way that I can make the windows printer dialogue box appear and
select the option "Selection" automatically in the "Print_What" area? I tried
the following but it doesn't select "Selection" and when I try to print it
keeps coming back.

Application.Dialogs(xlDialogPrint).Show ,,,,,,selection

Here's the complete reference info on xlDialogPrint:

Arg1: Range_Num: defines which pages to print:
1 = all pages in the workbook
2 = a specified range defined by the From and To values
Arg2: From: the first page to print (if Range_Num = 2)
Arg3: To: the last page to print (if Range_Num = 2)
Arg4: Copies: the number of copies to print (default=1)
Arg5: Draft: if specified, overrides the Draft quality setting of the Sheet tab of the xlDialogPrinterSetup dialog (the “Page Setup” dialog).
Arg6: Preview:
For the Excel4 PRINT macro:
True = the print-preview window is displayed
False = the print-preview window is not displayed
For VBA in Excel5 and later versions, has no effect. Use the xlDialogPrintPreview dialog instead.
Arg7: Print_What: print sheet (cell values) and/or notes (comments).
For the Excel4 PRINT macro, if specified, overrides the Notes setting of the PAGE.SETUP macro (the “Page Setup” dialog):
1 = Sheet (cell values) only
2 = Notes only
3 = Sheet and then notes
For VBA in Excel5 and later versions, if specified, overrides some Comments settings on the Sheet tab of the xlDialogPrinterSetup dialog:
1 = Overrides the “Page Setup” dialog’s Comments setting of “At end of sheet” to suppress printing of comments.
2 = Overrides the “Page Setup” dialog’s Comments setting of “(None)” to print comments (at the end of the sheet).
3 = (same as 1)
Note: has no effect on the Comments setting of “As displayed on sheet”.
Arg8: Color: if specified, overrides the Print Using Color setting in Excel for Mac.
Arg9: Feed: if specified, overrides the paper Feed Type setting in Excel for Mac.
1 = Continuous, for paper cassette (default)
2 = Cut sheet or manual feed
Arg10: Quality: if specified, overrides the Print quality setting on the Page tab of the xlDialogPrinterSetup dialog
Arg11: Y_Resolution: if specified and the selected printer has a vertical resolution that is different from the horizontal resolution (e.g. a dot matrix printer) then this setting overrides the Print quality setting on the Page tab of the xlDialogPrinterSetup dialog, for the vertical resolution.
Arg12: Selection: the (default) setting of the “Print what” section of the dialog:
1 = Selection (i.e. the selected cells and objects)
2 = Active sheet(s)
3 = Entire workbook
4 = List (the selected Excel List range)
Arg13: Printer_Text: The printer name. (The specified value is retained as the subsequent default value.)
Arg14: Print_To_File: the (default) setting of the “Print to file” option in the dialog (default=False)
Arg15: Collate: the (default) setting of the “Collate” option in the dialog (default=True)

Code:

'Example:

Const PrtDlgSel_Selection    As Integer = 1
Const PrtDlgSel_ActiveSheets As Integer = 2
Const PrtDlgSel_Workbook    As Integer = 3
Const PrtDlgSel_List        As Integer = 4

Application.Dialogs(xlDialogPrint).Show Arg4:=1, _
                                        Arg12:=PrtDlgSel_ActiveSheets, _
                                        Arg15:=True
                                       
'i.e.                                  Copies:=1, _
                                        Selection:=PrtDlgSel_ActiveSheets, _
                                        Collate:=True

'NOTE: the "Selection" argument sets the dialog's "Print what" options.


atishauros36

Quote:

Originally Posted by TonyD (Post 1354257)
Is there any way that I can make the windows printer dialogue box appear and
select the option "Selection" automatically in the "Print_What" area? I tried
the following but it doesn't select "Selection" and when I try to print it
keeps coming back.

Application.Dialogs(xlDialogPrint).Show ,,,,,,selection

If you want to know about the best printing in china, you can click there
printing in china hope you can learn something you need from there.


All times are GMT +1. The time now is 04:00 AM.

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