+ Reply to Thread
Results 1 to 5 of 5

Error on ExecuteExcel4Macro Page.Setup

  1. #1
    Claus
    Guest

    Error on ExecuteExcel4Macro Page.Setup

    Hi

    I'm getting an error (See JPG) when i try to use the Sub by John Green
    locatet on this site:
    http://groups.google.com/group/micro...c725d0d5a6b3d0
    I've copy/pasted it in my module without changing anything.
    The error is in the last line: Application.ExecuteExcel4Macro pSetUp

    I call the PS4 Sub from the site above from within the same Module using
    this code:

    For Each ws In Worksheets
    If Left(ws.Name, 1) = "E" Then
    ws.Select
    PS4
    End If
    Next

    I use XL2002, SP3

    I've got it working with the ordinary pagesetup, but it is painfully slow.

    Hoping for some guidance

    Regards,
    Claus




    Attached Images Attached Images

  2. #2
    Jim Cone
    Guest

    Re: Error on ExecuteExcel4Macro Page.Setup

    Claus,

    Not much help here, just some comments/questions...
    The John Green code (as is) works for me in xl2002.
    The xl4 code is very sensitive and all of the quote marks are required.
    Are you using Option Explicit and does your code compile?
    Arguments for margins are always in inches, regardless of your country setting.

    Regards,
    Jim Cone
    San Francisco, USA


    "Claus" <[email protected]> wrote in message
    news:[email protected]...
    Hi
    I'm getting an error (See JPG) when i try to use the Sub by John Green
    locatet on this site:
    http://groups.google.com/group/micro...c725d0d5a6b3d0
    I've copy/pasted it in my module without changing anything.
    The error is in the last line: Application.ExecuteExcel4Macro pSetUp
    I call the PS4 Sub from the site above from within the same Module using
    this code:
    For Each ws In Worksheets
    If Left(ws.Name, 1) = "E" Then
    ws.Select
    PS4
    End If
    Next
    I use XL2002, SP3
    I've got it working with the ordinary pagesetup, but it is painfully slow.
    Hoping for some guidance
    Regards,
    Claus

  3. #3
    Claus
    Guest

    Re: Error on ExecuteExcel4Macro Page.Setup

    Hi Jim

    Thanks for the clues, i've solved it.

    The problem was that the margins were numbers, that - because i use the
    Danish settings - were translated from 0.54 to 0,54 , thus making the
    pSetUp-string wrong.

    I simply turned the values into strings.

    Regards,
    Claus

    "Jim Cone" <[email protected]> skrev i en meddelelse
    news:%[email protected]...
    > Claus,
    >
    > Not much help here, just some comments/questions...
    > The John Green code (as is) works for me in xl2002.
    > The xl4 code is very sensitive and all of the quote marks are required.
    > Are you using Option Explicit and does your code compile?
    > Arguments for margins are always in inches, regardless of your country
    > setting.
    >
    > Regards,
    > Jim Cone
    > San Francisco, USA
    >
    >
    > "Claus" <[email protected]> wrote in message
    > news:[email protected]...
    > Hi
    > I'm getting an error (See JPG) when i try to use the Sub by John Green
    > locatet on this site:
    > http://groups.google.com/group/micro...c725d0d5a6b3d0
    > I've copy/pasted it in my module without changing anything.
    > The error is in the last line: Application.ExecuteExcel4Macro pSetUp
    > I call the PS4 Sub from the site above from within the same Module using
    > this code:
    > For Each ws In Worksheets
    > If Left(ws.Name, 1) = "E" Then
    > ws.Select
    > PS4
    > End If
    > Next
    > I use XL2002, SP3
    > I've got it working with the ordinary pagesetup, but it is painfully slow.
    > Hoping for some guidance
    > Regards,
    > Claus




  4. #4
    Claus
    Guest

    Re: Error on ExecuteExcel4Macro Page.Setup

    Hi again

    I can't control the font.

    Is is possible ?
    How ?

    Regards,
    Claus

    "Jim Cone" <[email protected]> skrev i en meddelelse
    news:%[email protected]...
    > Claus,
    >
    > Not much help here, just some comments/questions...
    > The John Green code (as is) works for me in xl2002.
    > The xl4 code is very sensitive and all of the quote marks are required.
    > Are you using Option Explicit and does your code compile?
    > Arguments for margins are always in inches, regardless of your country
    > setting.
    >
    > Regards,
    > Jim Cone
    > San Francisco, USA
    >
    >
    > "Claus" <[email protected]> wrote in message
    > news:[email protected]...
    > Hi
    > I'm getting an error (See JPG) when i try to use the Sub by John Green
    > locatet on this site:
    > http://groups.google.com/group/micro...c725d0d5a6b3d0
    > I've copy/pasted it in my module without changing anything.
    > The error is in the last line: Application.ExecuteExcel4Macro pSetUp
    > I call the PS4 Sub from the site above from within the same Module using
    > this code:
    > For Each ws In Worksheets
    > If Left(ws.Name, 1) = "E" Then
    > ws.Select
    > PS4
    > End If
    > Next
    > I use XL2002, SP3
    > I've got it working with the ordinary pagesetup, but it is painfully slow.
    > Hoping for some guidance
    > Regards,
    > Claus




  5. #5
    Jim Cone
    Guest

    Re: Error on ExecuteExcel4Macro Page.Setup

    Claus,
    Understanding and using the xl4 code for page setup was a
    major undertaking for me. I won't admit how long it took.
    I don't think it can be learned without the xl4 function help file...
    http://makeashorterlink.com/?B24052ACB

    "&nn Prints the characters that follow in the specified font size."
    I have used it this way...

    Dim nn as Long
    Dim Head as String
    dim strNumber as String
    nn = 12
    strNumber = "&" & nn
    Head = """&L" & strNumber & "Printed on &D" & "&C" & strNumber & _
    Application.OrganizationName

    also...
    the formatting codes for xl4 and later versions of Excel appear to be the same...

    Dim WordToUse as String
    WordToUse = "Never Upgrade"
    WordToUse = "&""ChevaraOutline,&B""&20" & WordToUse
    That should change the font to ChevaraOutline, make it bold and size 20.

    Regards,
    Jim Cone


    "Claus" <[email protected]> wrote in message news:[email protected]...
    Hi again
    I can't control the font.
    Is is possible ?
    How ?
    Regards,
    Claus


    > Claus,>
    > Not much help here, just some comments/questions...
    > The John Green code (as is) works for me in xl2002.
    > The xl4 code is very sensitive and all of the quote marks are required.
    > Are you using Option Explicit and does your code compile?
    > Arguments for margins are always in inches, regardless of your country
    > setting.>
    > Regards,
    > Jim Cone
    > San Francisco, USA



+ 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