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

    Home » Forums » AskWoody support » Productivity software by function » MS Word and word processing help » Macro Help! – PageWidth Setting (Word 2000 SR-1)

    Author
    Topic
    #360611

    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

    Viewing 1 reply thread
    Author
    Replies
    • #543445

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

    • #543462

      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.

      • #543506

        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.

    Viewing 1 reply thread
    Reply To: Macro Help! – PageWidth Setting (Word 2000 SR-1)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: