Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Error on printing

I have the procedure set out below where there may be the situation where a
printer is not connected or there is an error with the printer.

Sub printsummarybudget()
With Worksheets("SumBud").PageSetup
.CenterHorizontally = True
.Orientation = xlPortrait
.FitToPagesWide = 1
.FitToPagesTall = 1
End With
On Error Resume Next
Err.Clear
Worksheets("SumBud").Range("Sumbud").PrintOut Copies:=1, Preview:=False,
Collate:=True
If Err.Number < 0 Then MsgBox "There was an error printing or there is no
printer attached", vbExclamation, "Printer Problem"
On Error GoTo 0
End Sub

The problem is when I start the procedure I get a window with the Printer
Set-up option of selecting which printer I want to use. It is connected to a
network so there is a choice of printer. However if I am not connected and I
choose the Cancel option on the printer selection window I get a run-time
error 1004 "Unable to set the CentreHorizontally property of the Page Set up
Class." I would value any guidance on how to sort this situation. I
basically don't want any errors appearing if someone clicks the print
procedure when there are no printers attached. The above worked fine if
there was only one printer option but not now.

Kind Regards,
Graham Haughs
Turriff, Scotland


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 29
Default Error on printing

Hi, Graham,
Try this way:
Sub printsummarybudget()
With Worksheets("Sheet1").PageSetup
On Error GoTo EndMacro

.CenterHorizontally = True
.Orientation = xlPortrait
.FitToPagesWide = 1
.FitToPagesTall = 1
End With
Err.Clear
Worksheets("Sheet1").Range("A1:B10").PrintOut Copies:=1, Preview:=False,
Collate:=True
EndMacro:

If Err.Number < 0 Then MsgBox "There was an error printing or there is no
printer attached", vbExclamation, "Printer Problem"
On Error GoTo 0
End Sub

Regards.
Jorge
"Graham Haughs" escreveu na mensagem
...
I have the procedure set out below where there may be the situation where

a
printer is not connected or there is an error with the printer.

Sub printsummarybudget()
With Worksheets("SumBud").PageSetup
.CenterHorizontally = True
.Orientation = xlPortrait
.FitToPagesWide = 1
.FitToPagesTall = 1
End With
On Error Resume Next
Err.Clear
Worksheets("SumBud").Range("Sumbud").PrintOut Copies:=1,

Preview:=False,
Collate:=True
If Err.Number < 0 Then MsgBox "There was an error printing or there is no
printer attached", vbExclamation, "Printer Problem"
On Error GoTo 0
End Sub

The problem is when I start the procedure I get a window with the Printer
Set-up option of selecting which printer I want to use. It is connected to

a
network so there is a choice of printer. However if I am not connected and

I
choose the Cancel option on the printer selection window I get a run-time
error 1004 "Unable to set the CentreHorizontally property of the Page Set

up
Class." I would value any guidance on how to sort this situation. I
basically don't want any errors appearing if someone clicks the print
procedure when there are no printers attached. The above worked fine if
there was only one printer option but not now.

Kind Regards,
Graham Haughs
Turriff, Scotland




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
Excel Printing Error Jeff New Users to Excel 4 February 19th 08 05:39 PM
error message during printing Urgent ! Excel Discussion (Misc queries) 1 February 1st 06 05:03 PM
printing error Teri Excel Discussion (Misc queries) 2 September 13th 05 02:29 AM
printing error debbie @ Boettcher Setting up and Configuration of Excel 1 April 8th 05 07:31 PM
Printing PDF from Excel Error Kim[_13_] Excel Programming 1 September 23rd 04 09:31 PM


All times are GMT +1. The time now is 06:19 AM.

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"