+ Reply to Thread
Results 1 to 6 of 6

PageSetup Class

  1. #1
    P Dev
    Guest

    PageSetup Class

    I'm using the PageSetup class (late binding) in my application to set the
    following.

    ActiveSheet.PageSetup.Orientation = 2 ' Landscape
    ActiveSheet.PageSetup.LeftMargin = 36
    ActiveSheet.PageSetup.RightMargin = 36
    ActiveSheet.PageSetup.TopMargin = 54
    ActiveSheet.PageSetup.BottomMargin = 54
    ActiveSheet.PageSetup.RightFooter = "Page &P of &N"

    However, it depends on which environment I run the application as to whether
    or not it works.

    OS Excel Result
    Windows XP Pro v2002 SP2 2003 (11.6355.6360) SP1 Always Works
    Windows NT SP4 2003 (11.6355.6360) SP1 Does Not Work
    Windows XP Pro v2002 SP2 2002 (10.6501.6735) SP3 Does Not Work

    When it doesn't work, I receive the error message
    "Unable to set the Orientation property of the PageSetup class"

    If I comment out the Orientation property line, I receive the error message
    "Unable to set the LeftMargin property of the PageSetup class"

    Only when I comment out all the lines, will the application run without
    error under the environments mentioned above.

    Any ideas?


  2. #2
    Bob Phillips
    Guest

    Re: PageSetup Class

    Maybe grabbing at straws a bit here, but check References in the VBE
    (Tools>References), and if there are any, uncheck them.

    --

    HTH

    RP
    (remove nothere from the email address if mailing direct)


    "P Dev" <[email protected]> wrote in message
    news:[email protected]...
    > I'm using the PageSetup class (late binding) in my application to set the
    > following.
    >
    > ActiveSheet.PageSetup.Orientation = 2 ' Landscape
    > ActiveSheet.PageSetup.LeftMargin = 36
    > ActiveSheet.PageSetup.RightMargin = 36
    > ActiveSheet.PageSetup.TopMargin = 54
    > ActiveSheet.PageSetup.BottomMargin = 54
    > ActiveSheet.PageSetup.RightFooter = "Page &P of &N"
    >
    > However, it depends on which environment I run the application as to

    whether
    > or not it works.
    >
    > OS Excel Result
    > Windows XP Pro v2002 SP2 2003 (11.6355.6360) SP1 Always Works
    > Windows NT SP4 2003 (11.6355.6360) SP1 Does Not Work
    > Windows XP Pro v2002 SP2 2002 (10.6501.6735) SP3 Does Not Work
    >
    > When it doesn't work, I receive the error message
    > "Unable to set the Orientation property of the PageSetup class"
    >
    > If I comment out the Orientation property line, I receive the error

    message
    > "Unable to set the LeftMargin property of the PageSetup class"
    >
    > Only when I comment out all the lines, will the application run without
    > error under the environments mentioned above.
    >
    > Any ideas?
    >




  3. #3
    P Dev
    Guest

    Re: PageSetup Class

    I'm sorry, but I forgot to clarify that this is a VB.Net application.

    "Bob Phillips" wrote:

    > Maybe grabbing at straws a bit here, but check References in the VBE
    > (Tools>References), and if there are any, uncheck them.
    >
    > --
    >
    > HTH
    >
    > RP
    > (remove nothere from the email address if mailing direct)
    >
    >
    > "P Dev" <[email protected]> wrote in message
    > news:[email protected]...
    > > I'm using the PageSetup class (late binding) in my application to set the
    > > following.
    > >
    > > ActiveSheet.PageSetup.Orientation = 2 ' Landscape
    > > ActiveSheet.PageSetup.LeftMargin = 36
    > > ActiveSheet.PageSetup.RightMargin = 36
    > > ActiveSheet.PageSetup.TopMargin = 54
    > > ActiveSheet.PageSetup.BottomMargin = 54
    > > ActiveSheet.PageSetup.RightFooter = "Page &P of &N"
    > >
    > > However, it depends on which environment I run the application as to

    > whether
    > > or not it works.
    > >
    > > OS Excel Result
    > > Windows XP Pro v2002 SP2 2003 (11.6355.6360) SP1 Always Works
    > > Windows NT SP4 2003 (11.6355.6360) SP1 Does Not Work
    > > Windows XP Pro v2002 SP2 2002 (10.6501.6735) SP3 Does Not Work
    > >
    > > When it doesn't work, I receive the error message
    > > "Unable to set the Orientation property of the PageSetup class"
    > >
    > > If I comment out the Orientation property line, I receive the error

    > message
    > > "Unable to set the LeftMargin property of the PageSetup class"
    > >
    > > Only when I comment out all the lines, will the application run without
    > > error under the environments mentioned above.
    > >
    > > Any ideas?
    > >

    >
    >
    >


  4. #4
    Bob Phillips
    Guest

    Re: PageSetup Class

    Then I'm outa here I am afraid :-)

    Bob


    "P Dev" <[email protected]> wrote in message
    news:[email protected]...
    > I'm sorry, but I forgot to clarify that this is a VB.Net application.
    >
    > "Bob Phillips" wrote:
    >
    > > Maybe grabbing at straws a bit here, but check References in the VBE
    > > (Tools>References), and if there are any, uncheck them.
    > >
    > > --
    > >
    > > HTH
    > >
    > > RP
    > > (remove nothere from the email address if mailing direct)
    > >
    > >
    > > "P Dev" <[email protected]> wrote in message
    > > news:[email protected]...
    > > > I'm using the PageSetup class (late binding) in my application to set

    the
    > > > following.
    > > >
    > > > ActiveSheet.PageSetup.Orientation = 2 ' Landscape
    > > > ActiveSheet.PageSetup.LeftMargin = 36
    > > > ActiveSheet.PageSetup.RightMargin = 36
    > > > ActiveSheet.PageSetup.TopMargin = 54
    > > > ActiveSheet.PageSetup.BottomMargin = 54
    > > > ActiveSheet.PageSetup.RightFooter = "Page &P of &N"
    > > >
    > > > However, it depends on which environment I run the application as to

    > > whether
    > > > or not it works.
    > > >
    > > > OS Excel Result
    > > > Windows XP Pro v2002 SP2 2003 (11.6355.6360) SP1 Always Works
    > > > Windows NT SP4 2003 (11.6355.6360) SP1 Does Not Work
    > > > Windows XP Pro v2002 SP2 2002 (10.6501.6735) SP3 Does Not Work
    > > >
    > > > When it doesn't work, I receive the error message
    > > > "Unable to set the Orientation property of the PageSetup class"
    > > >
    > > > If I comment out the Orientation property line, I receive the error

    > > message
    > > > "Unable to set the LeftMargin property of the PageSetup class"
    > > >
    > > > Only when I comment out all the lines, will the application run

    without
    > > > error under the environments mentioned above.
    > > >
    > > > Any ideas?
    > > >

    > >
    > >
    > >




  5. #5
    NickHK
    Guest

    Re: PageSetup Class

    No idea about .Net
    But does the code work in VBA on all the OS's ?
    At least narrow it down to culprit.

    NickHK

    "P Dev" <[email protected]> wrote in message
    news:[email protected]...
    > I'm sorry, but I forgot to clarify that this is a VB.Net application.
    >
    > "Bob Phillips" wrote:
    >
    > > Maybe grabbing at straws a bit here, but check References in the VBE
    > > (Tools>References), and if there are any, uncheck them.
    > >
    > > --
    > >
    > > HTH
    > >
    > > RP
    > > (remove nothere from the email address if mailing direct)
    > >
    > >
    > > "P Dev" <[email protected]> wrote in message
    > > news:[email protected]...
    > > > I'm using the PageSetup class (late binding) in my application to set

    the
    > > > following.
    > > >
    > > > ActiveSheet.PageSetup.Orientation = 2 ' Landscape
    > > > ActiveSheet.PageSetup.LeftMargin = 36
    > > > ActiveSheet.PageSetup.RightMargin = 36
    > > > ActiveSheet.PageSetup.TopMargin = 54
    > > > ActiveSheet.PageSetup.BottomMargin = 54
    > > > ActiveSheet.PageSetup.RightFooter = "Page &P of &N"
    > > >
    > > > However, it depends on which environment I run the application as to

    > > whether
    > > > or not it works.
    > > >
    > > > OS Excel Result
    > > > Windows XP Pro v2002 SP2 2003 (11.6355.6360) SP1 Always Works
    > > > Windows NT SP4 2003 (11.6355.6360) SP1 Does Not Work
    > > > Windows XP Pro v2002 SP2 2002 (10.6501.6735) SP3 Does Not Work
    > > >
    > > > When it doesn't work, I receive the error message
    > > > "Unable to set the Orientation property of the PageSetup class"
    > > >
    > > > If I comment out the Orientation property line, I receive the error

    > > message
    > > > "Unable to set the LeftMargin property of the PageSetup class"
    > > >
    > > > Only when I comment out all the lines, will the application run

    without
    > > > error under the environments mentioned above.
    > > >
    > > > Any ideas?
    > > >

    > >
    > >
    > >




  6. #6
    P Dev
    Guest

    Re: PageSetup Class

    For anyone who's interested, the problem ended up being that the computers
    where the code did not work, did not have a default printer set up. Once a
    default printer was added, the code worked fine!

    "P Dev" wrote:

    > I'm sorry, but I forgot to clarify that this is a VB.Net application.
    >
    > "Bob Phillips" wrote:
    >
    > > Maybe grabbing at straws a bit here, but check References in the VBE
    > > (Tools>References), and if there are any, uncheck them.
    > >
    > > --
    > >
    > > HTH
    > >
    > > RP
    > > (remove nothere from the email address if mailing direct)
    > >
    > >
    > > "P Dev" <[email protected]> wrote in message
    > > news:[email protected]...
    > > > I'm using the PageSetup class (late binding) in my application to set the
    > > > following.
    > > >
    > > > ActiveSheet.PageSetup.Orientation = 2 ' Landscape
    > > > ActiveSheet.PageSetup.LeftMargin = 36
    > > > ActiveSheet.PageSetup.RightMargin = 36
    > > > ActiveSheet.PageSetup.TopMargin = 54
    > > > ActiveSheet.PageSetup.BottomMargin = 54
    > > > ActiveSheet.PageSetup.RightFooter = "Page &P of &N"
    > > >
    > > > However, it depends on which environment I run the application as to

    > > whether
    > > > or not it works.
    > > >
    > > > OS Excel Result
    > > > Windows XP Pro v2002 SP2 2003 (11.6355.6360) SP1 Always Works
    > > > Windows NT SP4 2003 (11.6355.6360) SP1 Does Not Work
    > > > Windows XP Pro v2002 SP2 2002 (10.6501.6735) SP3 Does Not Work
    > > >
    > > > When it doesn't work, I receive the error message
    > > > "Unable to set the Orientation property of the PageSetup class"
    > > >
    > > > If I comment out the Orientation property line, I receive the error

    > > message
    > > > "Unable to set the LeftMargin property of the PageSetup class"
    > > >
    > > > Only when I comment out all the lines, will the application run without
    > > > error under the environments mentioned above.
    > > >
    > > > Any ideas?
    > > >

    > >
    > >
    > >


+ 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