Update ALL fields automatically upon opening

  • Thread starter Thread starter David Harrison
  • Start date Start date
D

David Harrison

I've just used a macro from Jay Freedman that sucessfully
updates fields when you open the document. However I have
used and ASK field which then changes text within the
document by using corresponding IF fields.
BUT, (unfortunately) I still have to use "Select All +
F9" to bring up the Ask Questions - how can I prompt the
ASK field in Jay's "AutoOpen" Macro? (seen below)

Sub AutoOpen()
Options.UpdateFieldsAtPrint = True
Application.ScreenUpdating = False
PrintPreview = True
PrintPreview = False
ActiveDocument.ActiveWindow.View.Type = wdPrintView
Application.ScreenUpdating = True
End Sub


(PS Using Word 2000 on WinXP)
 
Hi, David,

The following version assumes that the ASK field is in the main text story,
not in a header/footer, text box, or autoshape (and I can't think why you'd
want it in any of those places, except possibly a text box). I also added
some code so that the UpdateFieldsAtPrint option is returned to its original
setting if the user had it turned off.

Public Sub AutoOpen()
Dim oFld As Field
Dim oldOpt As Boolean

oldOpt = Options.UpdateFieldsAtPrint

For Each oFld In ActiveDocument.Fields
If oFld.Type = wdFieldAsk Then
oFld.Update
End If
Next oFld

Options.UpdateFieldsAtPrint = True
Application.ScreenUpdating = False
PrintPreview = True
PrintPreview = False
ActiveWindow.View.Type = wdPrintView

Options.UpdateFieldsAtPrint = oldOpt
Application.ScreenUpdating = True
End Sub
 
Back
Top