Page 2 of 2 FirstFirst 12
Results 16 to 18 of 18
  1. #16
    Super Moderator
    Join Date
    May 2002
    Location
    Canberra, Australian Capital Territory, Australia
    Posts
    3,877
    Thanks
    0
    Thanked 182 Times in 167 Posts

    Re: Field Codes (Word 2007/Word 2003)

    Hi Steve,

    If you add the following macro to your document, and set the 'County' formfield to call it 'on exit', the header will update immediately.
    <pre>Sub UpdateHeader()
    With ActiveDocument
    .ScreenUpdating = False
    .PrintPreview
    .ClosePrintPreview
    .ScreenUpdating = True
    End With
    End Sub</pre>

    Hans has answered your other questions.
    Cheers,

    Paul Edstein
    [MS MVP - Word]

  2. #17
    2 Star Lounger
    Join Date
    Jan 2001
    Location
    Bartlesville, Oklahoma
    Posts
    145
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Field Codes (Word 2007/Word 2003)

    Paul,

    Many thanks for taking the time to write the macro for me. You all at WOPR are a good bunch!!!

    I did as you instructed (first time working with a working macro) and got an error "Runtime error 438. Object does not support this property or method." At home I opened the form in Word 2007 in compatibility mode. I saved the macro to the document, re-started the protection, and received the aforementioned error message. If I were to hazard a guess based upon our previous correspondence I'd say that my using Word 2007 to enter a macro for a previous version document caused the error. Yes?

  3. #18
    Super Moderator
    Join Date
    May 2002
    Location
    Canberra, Australian Capital Territory, Australia
    Posts
    3,877
    Thanks
    0
    Thanked 182 Times in 167 Posts

    Re: Field Codes (Word 2007/Word 2003)

    Hi Steve,

    Silly me - I attached the screenupdating code to the ActiveDocument Property, instead of to the Application Property. Corrected code follows:

    Sub UpdateHeader()
    Application.ScreenUpdating = False
    ActiveDocument.PrintPreview
    ActiveDocument.ClosePrintPreview
    Application.ScreenUpdating = True
    End Sub
    Cheers,

    Paul Edstein
    [MS MVP - Word]

Page 2 of 2 FirstFirst 12

Posting Permissions

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