Hey guys,
I have this exit macro which has worked flawlessly in both Mac and Windows until yesterday when I used it in a Windows table (Mac works flawlessly in tables). The code stalls on the fourth line "Selection.Fields.Unlink." If I reverse the sequence of the third (ActiveDocument.Unprotect) and fourth lines, it works for the tables but stalls in the body of the text. I'm stumped. Suggestions?
Code:
Sub UnlinkFieldsCensus()
' Unlink Fields Macro
Selection.MoveRight Unit:=wdCharacter, Count:=1
Selection.MoveUp Unit:=wdParagraph, Count:=1, Extend:=wdExtend
ActiveDocument.Unprotect
Selection.Fields.Unlink
Selection.MoveRight Unit:=wdCharacter, Count:=2
Dim Bookmark As Bookmark
ActiveDocument.Bookmarks.ShowHidden = True
If ActiveDocument.Bookmarks.Count >= 1 Then
For Each Bookmark In ActiveDocument.Bookmarks
Bookmark.Delete
Next Bookmark
End If
End Sub