Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #5  
Old 07-07-2020, 03:08 AM
MyUserName123 MyUserName123 is offline Macro to Mark Text with Index Codes Windows 10 Macro to Mark Text with Index Codes Office 2019
Novice
Macro to Mark Text with Index Codes
 
Join Date: Jul 2020
Posts: 10
MyUserName123 is on a distinguished road
Default

Quote:
Originally Posted by Guessed View Post
The code looks about right.

Is the last thing in your test document red text?

If you add this following line before myRange.Collapse, what is special about the selection when you step through the code?
myRange.Select
Hi, thanks for your response. No, the last text in the document is not red. It's just the regular automatic font color. The test document I'm using is all in normal with no styles or formatting at all.

I tried adding the line you suggested, but the only difference seems to be that when I step through the code I can see that the text in red is selected, but the result of the macro is the same whether I use that line or not. It just ends up in an infinite loop and includes those weird question mark in the box symbols in the index codes. With the exception of the very first index code that gets inserted.

I've been experimenting some more, and I think the problem might be that when the index code gets inserted, the curly braces surrounding it are red, so when it goes to move on to the next instance of red text, it stops on the index code and inserts another index code based on that, and it just keeps going.

Is the solution to somehow turn the newly inserted index code font color to wdAuto? I've tried doing that in several different ways, but I can't get it to work.
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro to Mark Text with Index Codes Macro for mark index entry for every word in a document? Jay Jay Word VBA 5 08-13-2015 03:44 PM
Hyperlinking from the Index to the Origin Mark Phil H Word 2 08-30-2013 04:03 AM
Index Addition Leaves Hidden Codes On SQLUSA Word 3 07-23-2012 02:58 AM
Options of Index Mark Entry smaria Word 1 04-22-2010 05:48 AM
Macro to mark non-coloured/non-highlighted text as hidden PeterB Word 0 10-28-2009 07:54 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 01:42 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