![]() |
|
#1
|
||||
|
||||
![]()
I think that looping through all fields is inefficient and would prefer a more direct Find method. This doesn't move the selection if there are no more Ref fields so you could add a complication for that wrinkle (and potentially allow the find to wrap).
Code:
Sub FindMeSeymour() ActiveWindow.View.ShowFieldCodes = True With Selection.Find .ClearFormatting .Replacement.ClearFormatting .Text = "^d REF" .Replacement.Text = "" .Forward = True .Wrap = wdFindStop .MatchCase = False .Execute End With ActiveWindow.View.ShowFieldCodes = False End Sub
__________________
Andrew Lockton Chrysalis Design, Melbourne Australia |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
zanodor | Word VBA | 5 | 07-15-2022 01:25 AM |
VBA Excel method Not working | grandneos | Excel | 2 | 01-07-2022 11:19 AM |
OrganizerCopy method for ActiveDocument | AnnaNmty | Word VBA | 4 | 07-25-2018 08:31 PM |
![]() |
Steve Bartko | Excel | 6 | 10-26-2016 11:38 AM |
![]() |
Cosmo | Word VBA | 4 | 10-18-2013 05:57 AM |