UpdateFields Macro

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I just hosed this macro accidentally. Can someone please give me the code so
I can recreate the thing?
 
Sub UpdateFields()
'
' UpdateFields Macro
' Macro recorded 6/21/2007 by Matthew B. Lambert. This updated all the
fields in the document including the header and footer after highlighting
everything.
'
Selection.WholeStory
Selection.Fields.Update
Selection.WholeStory
ActiveWindow.ActivePane.View.SeekView = _
wdSeekCurrentPageHeader
Selection.WholeStory
Selection.Fields.Update
Selection.WholeStory
End Sub
 
Do you have the original code that installed with Word? I need the one that
asks to update pages or entire table.

Thanks!
 
You are referring to the message box you get when you update the TOC?
Pressing F9 should generate this.

--
Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA

Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.
 
Not anymore. I hosed the macro that F9 triggers. I need the original code
for updatefields().
 
There is no original macro code. By default the F9 key is assigned to
the UpdateFields built-in command. Here's how to restore that
assignment:

Go to Tools > Customize and click the Keyboard button. In the left
column of the dialog, choose All Commands. In the right column, choose
UpdateFields. Put the cursor in the "Press new shortcut key" box and
press F9. (As a matter of curiosity, it will tell you what that key is
currently assigned to, but it doesn't matter.) Click the Assign button
and then close both dialogs. If you're prompted to save Normal.dot the
next time you close Word, answer yes.

By the way, you'll be asked how to update the table of contents only
if you're actually updating the TOC, meaning that it's selected (with
or without other text) at the time you press F9.

--
Regards,
Jay Freedman
Microsoft Word MVP
Email cannot be acknowledged; please post all follow-ups to the
newsgroup so all may benefit.
 
Will reassignment work even if I wrote a macro to overwrite UpdatFields? I
trashed UpdateFields on my machine at work so I can't research reassignment
right now.
 
UpdateFields is the in-built command that updates selected fields. If you
create a macro with the same name, it intercepts and replaces the original
command. If you have screwed this macro, then delete it to revert to the
original in-built command.
If you want a macro that updates all the fields in the document save it with
a slightly different name see http://www.gmayor.com/installing_macro.htm

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
Thank you. Your explanation told me everything I needed to know. It's just
somewhat confusing that I can bring up a list of Word commands using the
Macros dialog box, where the drop-down list title is "Macros in:" . I leaned
toward believeing that those listed Word commands were actually macros.
 
If the macro is listed in the macros list (tools > macro > macros - Word
97-2003 or Macros from the Developer Tab in Word 2007 ) , then you do have a
macro of the same name. As I indicated, this will replace the function of
the built-in function of the same name.

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top