Is there a way to update all fields in a document at once?

K

kc

Version: 2008
Operating System: Mac OS X 10.5 (Leopard)
Processor: intel

I am creating a template that will include several fields and am hoping to make it as easy on the user as possible. I do not know Apple Script yet, so I'm hoping there is some shortcut that doesn't involve coding that I can simply instruct the user to do once they've finished filling in the basic information. Any help would really be appreciated.

Thanks!
 
E

Elliott Roper

Version: 2008
Operating System: Mac OS X 10.5 (Leopard)
Processor: intel

I am creating a template that will include several fields and am hoping to
make it as easy on the user as possible. I do not know Apple Script yet, so
I'm hoping there is some shortcut that doesn't involve coding that I can
simply instruct the user to do once they've finished filling in the basic
information. Any help would really be appreciated.
This is for 2004. It should stay the same.
Select all, then 'update fields'
'update fields' default shortcut is F9
...which Apple takes first bite at for something like Expose.

That leaves your users with 2 choices. Change Apple's shortcut or
Word's. I opted for the former since there is a whole tribe of Word
shortcuts relating to fields that use f9 in combination with other
keys.
 
C

CyberTaz

Hello KC -

In addition to Elliott's reply there's an additional keystroke assigned by
default for the UpdateFields command:

Shift+Option+Command+U

You really don't have to be a contortionist to use it:)

HTH |:>)
Bob Jones
[MVP] Office:Mac
 
J

John McGhie

Hi KC:

Elliot and Bob are both correct. However, there are multiple places a Word
document can have fields. The Keystrokes only update the "Text Story" you
happen to be in.

In other words, it won't do the headers and footers in each section, like
you would hope it would.

This will:

Public Sub FieldsUpdateAll()
Dim FieldID As Long
Dim aStory As Range

For Each aStory In ActiveDocument.StoryRanges
FieldID = aStory.Fields.Update
If FieldID <> 0 Then
aStory.Fields(FieldID).Select

MsgBox "Field " & aStory.Fields(FieldID).Code.Text & _
" has an error", vbExclamation
End

End If
Next ' aStory

End Sub

If you beg and plead, one of the kindly ApleScript coders in here will
convert that to AppleScript for you.

All it does is loop through all the text stories in the document updating
fields. It wills top at the first field that won't update due to an error
and select it, so you can see where the little urchin is!

This was coded for Word 2000 originally. In Word 2007, a field can
potentially return "-1" if the document is corrupt. There's nothing wrong
with the field in that case, it's the document that's bad.

You can deal with this one of two ways:
1) Change If FieldID <> 0 to If FieldID > 0... This will enable you to
ignore the error and get the document out the door. If the corruption gets
bad enough, Word will crash so you will know to fix it when that happens :)

2) Change the macro to throw up an error message and stop, such as "The
Document is Corrupt". Then you have to Maggie (de-corrupt) the document.

Hope this helps


Hello KC -

In addition to Elliott's reply there's an additional keystroke assigned by
default for the UpdateFields command:

Shift+Option+Command+U

You really don't have to be a contortionist to use it:)

HTH |:>)
Bob Jones
[MVP] Office:Mac

--
Don't wait for your answer, click here: http://www.word.mvps.org/

Please reply in the group. Please do NOT email me unless I ask you to.

John McGhie, Microsoft MVP, Word and Word:Mac
Sydney, Australia. mailto:[email protected]
 
C

Clive Huggan

Hmm, I must remember to recommend that one, Bob, even though it's more
difficult to do in the southern hemisphere...

It avoids having to tell people about Apple's charming hijacking of the F9
set of commands.

Clive
======
 
C

CyberTaz

Hello Clive -

<snip>
Hmm, I must remember to recommend that one, Bob, even though it's more
difficult to do in the southern hemisphere...
<snip>

Heh - I thought I learned that one from *you*;-)

Regards |:>)
Bob Jones
[MVP] Office:Mac
 
C

Clive Huggan

Hello Clive -

<snip>

<snip>

Heh - I thought I learned that one from *you*;-)

Regards |:>)
Bob Jones
[MVP] Office:Mac
Yes, could well be, Bob (um, now I see it: page 21 of Bend Word) -- but you
know with my memory I often drop things like that in someone else's
bailiwick -- much like the cuckoo -- to look after it. ;-)

Clive
=====
 

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

Top