Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 01-26-2017, 06:40 AM
brent chadwick brent chadwick is offline Error with exit macro Windows 8 Error with exit macro Office 2013
Advanced Beginner
Error with exit macro
 
Join Date: Mar 2015
Posts: 86
brent chadwick is on a distinguished road
Default Error with exit macro

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
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Error with exit macro Help with Macro error jar208 Excel Programming 2 12-06-2016 03:57 PM
Pictures animated exit abc3132 PowerPoint 0 02-26-2015 12:27 AM
Error with exit macro VBA error Content Control On Exit jec1 Word VBA 5 08-16-2014 08:14 PM
Error with exit macro Drop-Downs: Run Macro on Exit Andrew H Word VBA 15 11-16-2012 08:34 AM
Is there an exit on close ? mhdadmh Word 0 10-12-2006 04:28 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 02:53 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft