![]() |
#2
|
||||
|
||||
![]()
I have not worked with the Mac version, but the following should work
Code:
Sub Macro1() 'Graham Mayor - https://www.gmayor.com - Last updated - 02 Dec 2020 Dim i As Integer Dim oStory As Range For Each oStory In ActiveDocument.StoryRanges For i = oStory.Fields.Count To 1 Step -1 If oStory.Fields(i).Type = wdFieldRef And _ oStory.Fields(i).Result = "Error! Reference source not found." Then oStory.Fields(i).Delete End If Next i If oStory.StoryType <> wdMainTextStory Then While Not (oStory.NextStoryRange Is Nothing) Set oStory = oStory.NextStoryRange For i = oStory.Fields.Count To 1 Step -1 If oStory.Fields(i).Type = wdFieldRef And _ oStory.Fields(i).Result = "Error! Reference source not found." Then oStory.Fields(i).Delete End If Next i Wend End If Next oStory lbl_Exit: Set oStory = Nothing Exit Sub End Sub
__________________
Graham Mayor - MS MVP (Word) (2002-2019) Visit my web site for more programming tips and ready made processes www.gmayor.com |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
Slamzor | Word VBA | 1 | 12-01-2017 05:12 PM |
![]() |
lodi123 | Word | 2 | 03-28-2017 11:24 PM |
![]() |
frannie | Word | 2 | 03-23-2017 04:33 PM |
![]() |
Maddog32 | Word | 2 | 06-10-2016 02:39 PM |
![]() |
mpdsal | Word | 1 | 07-26-2012 01:05 PM |