Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
jo jo is offline
external usenet poster
 
Posts: 4
Default Excel PageSetup Error even when a printer Exists

Hi,

we run batch jobs to create Excel document. The code worked fine in XP
but in Win 2k it fails wiht the following error:

Description: Unable to set the Orientation property of the PageSetup
class

I have a default printer installed and the job complets some times but
most of the time it fails. The printer has all the required [its a
XEROX workstation] properties but the job failes.

there are looot of addins that formats their final excel document and
most of them failes.

here is a sample code:

With ActiveWorkbook
For Each wsSheet In .Worksheets ' Go through all worksheets
With wsSheet
With .PageSetup ' Set PageSetup properties
If (lOrientation 0) Then .Orientation =
lOrientation 'its a long and value is 2
If bCenterHorizontally Then
..CenterHorizontally = True
If bCenterVertically Then .CenterVertically
= True
If Len(sTitleRows) 0 Then .PrintTitleRows
= sTitleRows
If Len(sTitleColumns) 0 Then
..PrintTitleColumns = sTitleColumns
If Len(sPrintArea) 0 Then .PrintArea =
sPrintArea
If dTopMargin 0 Then .TopMargin =
dTopMargin
If dBottomMargin 0 Then .BottomMargin =
dBottomMargin
If dLeftMargin 0 Then .LeftMargin =
dLeftMargin
If dRightMargin 0 Then .RightMargin =
dRightMargin
End With
End With
Next wsSheet

End With

do we need to change any settings in the system???

can any one help in this???

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default Excel PageSetup Error even when a printer Exists

Jo,
What Debug.Print lOrientation = xlLandscape show ?

NickHk

"jo" wrote in message
oups.com...
Hi,

we run batch jobs to create Excel document. The code worked fine in XP
but in Win 2k it fails wiht the following error:

Description: Unable to set the Orientation property of the PageSetup
class

I have a default printer installed and the job complets some times but
most of the time it fails. The printer has all the required [its a
XEROX workstation] properties but the job failes.

there are looot of addins that formats their final excel document and
most of them failes.

here is a sample code:

With ActiveWorkbook
For Each wsSheet In .Worksheets ' Go through all worksheets
With wsSheet
With .PageSetup ' Set PageSetup properties
If (lOrientation 0) Then .Orientation =
lOrientation 'its a long and value is 2
If bCenterHorizontally Then
.CenterHorizontally = True
If bCenterVertically Then .CenterVertically
= True
If Len(sTitleRows) 0 Then .PrintTitleRows
= sTitleRows
If Len(sTitleColumns) 0 Then
.PrintTitleColumns = sTitleColumns
If Len(sPrintArea) 0 Then .PrintArea =
sPrintArea
If dTopMargin 0 Then .TopMargin =
dTopMargin
If dBottomMargin 0 Then .BottomMargin =
dBottomMargin
If dLeftMargin 0 Then .LeftMargin =
dLeftMargin
If dRightMargin 0 Then .RightMargin =
dRightMargin
End With
End With
Next wsSheet

End With

do we need to change any settings in the system???

can any one help in this???



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 2002/Windows XP - PageSetup error [email protected] Excel Programming 6 March 2nd 05 05:40 PM
Using .pagesetup with no installed printer Patrick McNeil Excel Programming 0 February 15th 05 05:55 PM
Help - Error: Unable to set the PrintArea property of the PageSetup class Marie J-son[_5_] Excel Programming 3 January 5th 05 02:04 PM
pagesetup 1004 error irashkin Excel Programming 1 March 5th 04 11:44 PM
Printer error building Excel workbook...? Martin[_15_] Excel Programming 1 February 26th 04 04:00 PM


All times are GMT +1. The time now is 11:55 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"