[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
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,507 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
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: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone 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 would like to show you some basics you can do with Mailings in MS Word. It´s quite handy feature you can use for creating envelopes, labels, personalized letters etc. First question could be what is this feature good for? Mailing can really he…
This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
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 …

834 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