After thinking about this, what I probably did was the following. Rebooted my computer, determined the code didn't work at all (because hidden bookmarks weren't being shown). Incredulous (since I had been working on other parts of the code for hours), I then put a break after the first set of bookmark manipulations. Those didn't work, but to check, I had to show the hidden bookmarks. I then finished running the code, and it appeared the second set of bookmark manipulations worked...because they did because hidden bookmarks were no longer hidden.
And I did something similar at home and at work, never realizing that every time I went to debug this, I showed hidden bookmarks, which allowed the code (or part of it, depending on where I put a break) to work.
I never realized it until I stumbled upon it today, then I tested it by turning on showing hidden bookmarks manually after a reboot before running the code. Then the code worked.
I asked ChatGPT how to enable bookmarks via VBA, and got two wrong answers. I did a search and found Microsoft's discussion of this, and used their code (the code I show above). Sometimes, ChatGPT is helpful, but many times, it's not.
|