macro for highlighting text formatting

  • Thread starter Thread starter swebber27
  • Start date Start date
S

swebber27

Hi,

I'm trying to create a macro that will automatically highlight specific
text formatting, like ital, bold, etc. I find that I can get it to work
when I enter something into the text field, but when I leave that field
blank (which is what I want, because I want it to highlight all
instances of italic) the macro will not work.

Can anyone help, or do you know of a macro for this?

thanks, SMW
 
The macro recorder has a bug that prevents it from recording your formatting
selections in the Find dialog. You'll have to fix it by hand. See
http://word.mvps.org/FAQs/MacrosVBA/ModifyRecordedMacro.htm, in the section
"Fixing broken Replace macros".

--
Regards,
Jay Freedman
Microsoft Word MVP
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.
 
Jay,

Thanks for the help. What code should I enter in the VBA editor to tell
it to highlight text?

SMW
 
To have it highlight all italic text, take the entire macro called Macro4A()
from the article I mentioned, and change the line

.Replacement.Font.Bold = True

to

.Replacement.Highlight = True

If you want to look for some other formatting, change the .Font.Italic line,
for example,

.Font.Bold = True

--
Regards,
Jay Freedman
Microsoft Word MVP
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top