?
Solved

VBA - Change Font Color of a Line of Text Based on First non-Blank Character

Posted on 2014-04-01
2
Medium Priority
?
1,459 Views
Last Modified: 2014-04-02
Would appreciate assistance with a WORD VBA routine.

Based on the current selection, change the font color to Green for the entire line of text for any line where the first non-blank character is a tick mark ( ' ).  

I am copying VBA code into a WORD document and want to color the comment lines green in the document.  I am familiar with Excel VBA but have no experience with WORD VBA so the more explicit the better.

Thank You,
Jerry
0
Comment
Question by:Jerry Paladino
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 22

Accepted Solution

by:
Flyster earned 2000 total points
ID: 39971418
See if this gives you the results you're looking for:
Sub Color_Rem()
Application.ScreenUpdating = False
With ActiveDocument.Content.Find
  .ClearFormatting
  .Text = " '[!^13]{1,}"
    With .Replacement
      .Text = "^&"
      .ClearFormatting
      .Font.Color = wdColorGreen
    End With
      .Forward = True
      .Wrap = wdFindContinue
      .Format = True
      .MatchWildcards = True
      .Execute Replace:=wdReplaceAll
    End With
  Application.ScreenUpdating = True
End Sub

Open in new window

Flyster
0
 
LVL 16

Author Closing Comment

by:Jerry Paladino
ID: 39971925
Thank you Flyster - Much appreciated.
Jerry
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I'm writing to share my clumsy experience in using this elegant tool so you can avoid every stupid mistake I made. (I leave it to the authorities to decide if this deserves a place in the Knowledge archives.)  Now that I am on the other side of my l…
Shortcuts in Word Just the other day I had a training for Microsoft and they wanted me to show how well the new Windows and Office behaved on a touch device, which by the way is great, but it was only then that I realized that using keyboard shortc…
This video walks the viewer through the process of creating envelopes and labels, with multiple names and addresses. Navigate to the “Start Mail Merge” button in the Mailings tab: Follow the step-by-step process until asked to find the address doc…
In a previous video Micro Tutorial here at Experts Exchange (http://www.experts-exchange.com/videos/1358/How-to-get-a-free-trial-of-Office-365-with-the-Office-2016-desktop-applications.html), I explained how to get a free, one-month trial of Office …
Suggested Courses

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question