Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Print page one of sheet only
I am using the code, Application.Dialogs(xlDialogPrint).Show (so the user can
select their printer) and I need to disable the Print Range in the dialog box so that other pages cant be printed. Is there code I can use to only print page 1 of the sheet. I have tried code that works but if you click cancel in the dialog box it goes ahead and prints it anyway. I hope this makes sense to one of the experts. Thanks for any help -- ypukpete |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Print page one of sheet only
The following only allows the user to select the printer and printer setup.
Does not allow selection of pages to print. Then the second line to actually print. Application.Dialogs(xlDialogPrinterSetup).Show ActiveWindow.SelectedSheets.PrintOut from:=1, to:=1, _ copies:=1, collate:=True Note that the space and underscore at the end of a line is a line break in an otherwise single line of code. -- Regards, OssieMac "ypukpete" wrote: I am using the code, Application.Dialogs(xlDialogPrint).Show (so the user can select their printer) and I need to disable the Print Range in the dialog box so that other pages cant be printed. Is there code I can use to only print page 1 of the sheet. I have tried code that works but if you click cancel in the dialog box it goes ahead and prints it anyway. I hope this makes sense to one of the experts. Thanks for any help -- ypukpete |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Print page one of sheet only
Thanks OssieMac. That is similar to the code I am using which works OK, but
if the user clicks on the cancel button in the print dialog box, it does not cancel the printing. Is there away to correct this? -- ypukpete "OssieMac" wrote: The following only allows the user to select the printer and printer setup. Does not allow selection of pages to print. Then the second line to actually print. Application.Dialogs(xlDialogPrinterSetup).Show ActiveWindow.SelectedSheets.PrintOut from:=1, to:=1, _ copies:=1, collate:=True Note that the space and underscore at the end of a line is a line break in an otherwise single line of code. -- Regards, OssieMac "ypukpete" wrote: I am using the code, Application.Dialogs(xlDialogPrint).Show (so the user can select their printer) and I need to disable the Print Range in the dialog box so that other pages cant be printed. Is there code I can use to only print page 1 of the sheet. I have tried code that works but if you click cancel in the dialog box it goes ahead and prints it anyway. I hope this makes sense to one of the experts. Thanks for any help -- ypukpete |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Print page one of sheet only
Hi again,
The following example should point you in the right direction. Sub test() Dim userResponse As Boolean userResponse = Application.Dialogs(xlDialogPrinterSetup).Show If userResponse = False Then MsgBox "User clicked Cancel" 'Insert your code here in lieu of msgbox to handle the cancel Else 'Remove msgbox and uncomment the printout line MsgBox "User clicked OK" 'ActiveWindow.SelectedSheets.PrintOut from:=1, to:=1, _ copies:=1, collate:=True End If End Sub -- Regards, OssieMac "ypukpete" wrote: Thanks OssieMac. That is similar to the code I am using which works OK, but if the user clicks on the cancel button in the print dialog box, it does not cancel the printing. Is there away to correct this? -- ypukpete "OssieMac" wrote: The following only allows the user to select the printer and printer setup. Does not allow selection of pages to print. Then the second line to actually print. Application.Dialogs(xlDialogPrinterSetup).Show ActiveWindow.SelectedSheets.PrintOut from:=1, to:=1, _ copies:=1, collate:=True Note that the space and underscore at the end of a line is a line break in an otherwise single line of code. -- Regards, OssieMac "ypukpete" wrote: I am using the code, Application.Dialogs(xlDialogPrint).Show (so the user can select their printer) and I need to disable the Print Range in the dialog box so that other pages cant be printed. Is there code I can use to only print page 1 of the sheet. I have tried code that works but if you click cancel in the dialog box it goes ahead and prints it anyway. I hope this makes sense to one of the experts. Thanks for any help -- ypukpete |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Print page one of sheet only
Thanks OssieMac it is what I want, I can also use this application for other
problems as well. Thanks for your time helping me. -- ypukpete "OssieMac" wrote: Hi again, The following example should point you in the right direction. Sub test() Dim userResponse As Boolean userResponse = Application.Dialogs(xlDialogPrinterSetup).Show If userResponse = False Then MsgBox "User clicked Cancel" 'Insert your code here in lieu of msgbox to handle the cancel Else 'Remove msgbox and uncomment the printout line MsgBox "User clicked OK" 'ActiveWindow.SelectedSheets.PrintOut from:=1, to:=1, _ copies:=1, collate:=True End If End Sub -- Regards, OssieMac "ypukpete" wrote: Thanks OssieMac. That is similar to the code I am using which works OK, but if the user clicks on the cancel button in the print dialog box, it does not cancel the printing. Is there away to correct this? -- ypukpete "OssieMac" wrote: The following only allows the user to select the printer and printer setup. Does not allow selection of pages to print. Then the second line to actually print. Application.Dialogs(xlDialogPrinterSetup).Show ActiveWindow.SelectedSheets.PrintOut from:=1, to:=1, _ copies:=1, collate:=True Note that the space and underscore at the end of a line is a line break in an otherwise single line of code. -- Regards, OssieMac "ypukpete" wrote: I am using the code, Application.Dialogs(xlDialogPrint).Show (so the user can select their printer) and I need to disable the Print Range in the dialog box so that other pages cant be printed. Is there code I can use to only print page 1 of the sheet. I have tried code that works but if you click cancel in the dialog box it goes ahead and prints it anyway. I hope this makes sense to one of the experts. Thanks for any help -- ypukpete |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Print one page per sheet | Excel Discussion (Misc queries) | |||
Print sheet 1 on front sheet 2 on back of a page | Excel Programming | |||
Active cell counting in particular print page (one sheet having different print area) | Excel Worksheet Functions | |||
How can I print page 2 of each sheet in a workbook? | Excel Discussion (Misc queries) | |||
How to print last page of sheet? | Excel Programming |