+ Reply to Thread
Results 1 to 2 of 2

Excel PageSetup Error even when a printer Exists

  1. #1
    jo
    Guest

    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. #2
    NickHK
    Guest

    Re: Excel PageSetup Error even when a printer Exists

    Jo,
    What Debug.Print lOrientation = xlLandscape show ?

    NickHk

    "jo" <[email protected]> wrote in message
    news:[email protected]...
    > 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 to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1