Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 26
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,510
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 26
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,510
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 26
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Print one page per sheet Very Basic User Excel Discussion (Misc queries) 3 March 9th 10 12:42 PM
Print sheet 1 on front sheet 2 on back of a page J.W. Aldridge Excel Programming 1 November 16th 06 10:23 PM
Active cell counting in particular print page (one sheet having different print area) ananthmca2004 Excel Worksheet Functions 1 November 24th 05 11:29 AM
How can I print page 2 of each sheet in a workbook? sflower Excel Discussion (Misc queries) 1 March 9th 05 02:15 PM
How to print last page of sheet? kcm Excel Programming 4 October 20th 04 05:20 PM


All times are GMT +1. The time now is 11:25 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"