Excel PageSetup Error even when a printer Exists

J

jo

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???
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top