Results 1 to 4 of 4
  1. #1
    3 Star Lounger rcbjr2's Avatar
    Join Date
    Jan 2001
    Location
    Matthews, NC
    Posts
    279
    Thanks
    6
    Thanked 1 Time in 1 Post

    Macro Help! - PageWidth Setting (Word 2000 SR-1)

    Recently, one of my macros quit working. Not sure exactly when, and I can't figure out why.

    I'm using this line in a macro:
    vPageWidth = ActiveDocument.PageSetup.PageWidth

    I've set up vPageWidth as a String (not sure if that's correct, but it's worked for a year now that way).

    When the macro runs, vPageWidth becomes "999999". I then use vPathWidth in an equation to figure out margins (I'm also grabbing margin info which comes as "999999".

    A few lines down in the macro, I get an error that values have to be between -1549 pt and 1549 pts (which I assume is the maximum size for a page).

    Why would this stop working all of a sudden? Has something changed in Word to make this different? Or do I just have it set up wrong (which is strange, cause like I said it worked for a year).

    Thanks!

    -Rich Belthoff

  2. #2
    3 Star Lounger
    Join Date
    Feb 2001
    Location
    Willow Grove, Pennsylvania, USA
    Posts
    205
    Thanks
    4
    Thanked 49 Times in 40 Posts

    Re: Macro Help! - PageWidth Setting (Word 2000 SR-1)

    Hi, Rich,

    I just tried it (I'm also using Word 2000 SR-1) and it works fine for me. I tried declaring vPageWidth both as a String and as a Single (which is what the Help topic for .PageWidth says it returns)... same result. For an 8.5" Letter page, for instance, I get 612, which is 8.5 inches * 72 points/inch.

    Maybe your printer driver is returning some funny results to Word? <img src=/S/shrug.gif border=0 alt=shrug width=39 height=15>

  3. #3
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Macro Help! - PageWidth Setting (Word 2000 SR-1)

    I have gotten 9999999 results when seeking properties that were not consistent for the specified object. I am able to get this for your function call if I have more than one section in ActiveDocument, and the measurements are different in different sections. In your case, since you really only care about the current section, you could try:

    Selection.Sections(1).PageSetup.PageWidth

    If this isn't it, well, someone else might know.

  4. #4
    3 Star Lounger rcbjr2's Avatar
    Join Date
    Jan 2001
    Location
    Matthews, NC
    Posts
    279
    Thanks
    6
    Thanked 1 Time in 1 Post

    Re: Macro Help! - PageWidth Setting (Word 2000 SR-1)

    Thank you very much! That's exactly the problem. I don't usually use sections in documents, but this one has a different section, so that's what it was. As soon as I used Sections(1) in my macro code, it worked.

    -Rich.

Posting Permissions

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