View Single Post
 
Old 02-19-2015, 10:27 PM
Guessed's Avatar
Guessed Guessed is offline Windows 7 32bit Office 2010 32bit
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 3,977
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

Macros using selections are not a great idea and I haven't ever felt the need to use discontinuous selections for anything.

How about you specify the type of field you want to update. The sample document you posted had a bunch of pageref fields so you can update just those like this. It is simple to expand this macro to include or exclude other types of fields if you know what you want to do.
Code:
Sub UpdateFields()
  Dim aFld As Field
  For Each aFld In ActiveDocument.Fields
    Debug.Print aFld.Type & ": " & aFld.Code
    If aFld.Type = wdFieldPageRef Then
      aFld.Update
    End If
  Next aFld
End Sub
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote