Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #3  
Old 03-23-2024, 12:53 PM
ctviggen ctviggen is offline Code that changes hidden bookmarks/cross-references works...sometimes Windows 10 Code that changes hidden bookmarks/cross-references works...sometimes Office 2016
Advanced Beginner
Code that changes hidden bookmarks/cross-references works...sometimes
 
Join Date: Feb 2021
Posts: 54
ctviggen is on a distinguished road
Default

Sorry for my delay in responding. I figured out what was wrong, via a lot of time. When I rebooted, I could not get this code to work. But when I manually showed bookmarks (ctrl-shift-F5, choose "hidden bookmarks"), then the code worked fine. I had to add this code before any bookmark manipulation:


Code:
ActiveDocument.Bookmarks.ShowHidden = True

Then the code works fine.


Andrew, thank you for the comment. I am doing something probably no one does. I have some numbered paragraphs with cross references in them. I copy this text, put the cursor below it, then I want to put a modified version of this code there, with updated bookmarks/cross-references, then put yet another modified version of this code there, with yet further updated bookmarks/cross-references.



What I do is copy the text to a new document, change the bookmarks/cross-references, change the text, go to the bottom of the new document, paste the original text in again, change the bookmarks/cross-reference, manipulate it in a different way, then paste all the text in the new document back to the insertion point.


If you have suggestions about a better way to loop through bookmarks from the start and removing+adding bookmarks while you are doing it, I'm open to suggestions. This code does work, and in my debugging, I went through it line-by-line to see exactly what it did. But I'm always open for suggestions of something better/less likely to cause error/better programming techniques, etc.
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Code that changes hidden bookmarks/cross-references works...sometimes Is there a way to summarise all bookmarks and cross references used in a Word document? Training Word VBA 1 11-09-2017 12:06 AM
Where to put Subroutine to make sure bookmarks aren't deleted so cross-references work mrsjetset Word VBA 5 06-29-2016 05:06 PM
Convert manual cross references in footnotes to other footnotes to automatic cross references ghumdinger Word VBA 7 11-20-2014 11:47 PM
Code that changes hidden bookmarks/cross-references works...sometimes Bookmarks & cross-references Suchoklates Word 1 09-19-2013 02:32 AM
Bookmarks with different figure references Dan_68 Word 0 02-15-2010 08:29 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 04:20 PM.


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