![]() |
|
#1
|
|||
|
|||
![]() i want to change font in a doc from the first /* to the next */ (these are comments in PL/1 programming language). i think i need a range object but i don't know how to create one from two find objects. can anyone help please ? |
#2
|
||||
|
||||
![]()
Try this with a Wildcard search
Find: /[*]{1}*\*/ Replace: leave the box empty but with the cursor in the box, select Format > Font and choose your colour.
__________________
Andrew Lockton Chrysalis Design, Melbourne Australia |
#3
|
|||
|
|||
![]()
thank you, but maybe i wasn't clear - i want to do this in a VBA Sub
|
#4
|
||||
|
||||
![]()
So record a macro that is created when you do the search and replace. You can then tweak the code to make it read better or do different things.
__________________
Andrew Lockton Chrysalis Design, Melbourne Australia |
#5
|
|||
|
|||
![]() Code:
Sub Demo() Dim oRng As Range Set oRng = ActiveDocument.Range With oRng.Find .ClearFormatting .Text = "/\*{1}*/\*{1}" .MatchWildcards = True While .Execute oRng.Start = oRng.Start + 2 oRng.End = oRng.End - 2 oRng.Style = ActiveDocument.Styles("Strong") 'replace with your style oRng.End = oRng.End + 2 oRng.Collapse wdCollapseEnd Wend End With lbl_Exit: Exit Sub End Sub |
#6
|
|||
|
|||
![]()
thank you to all
i will try everything tomorrow KRs ron |
#7
|
|||
|
|||
![]()
it works !
brill !!! thanks guys |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
jackcoletti | Word | 3 | 02-01-2017 08:10 AM |
![]() |
RHODIUM | Word | 6 | 10-01-2016 04:43 PM |
Compare text from Bookmark with text from Text box | Byron Polk | Word VBA | 4 | 07-30-2014 06:18 AM |
Ink tools graying out randomly | andyjames | PowerPoint | 1 | 01-09-2013 12:54 AM |