Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 08-03-2019, 06:46 AM
ronnaldo ronnaldo is offline graying out text from /* to */ Windows 7 64bit graying out text from /* to */ Office 2010
Novice
graying out text from /* to */
 
Join Date: Aug 2019
Posts: 4
ronnaldo is on a distinguished road
Default graying out text from /* to */


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 ?
Reply With Quote
  #2  
Old 08-03-2019, 04:41 PM
Guessed's Avatar
Guessed Guessed is offline graying out text from /* to */ Windows 10 graying out text from /* to */ Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 4,159
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

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
Reply With Quote
  #3  
Old 08-04-2019, 02:46 AM
ronnaldo ronnaldo is offline graying out text from /* to */ Windows 7 64bit graying out text from /* to */ Office 2010
Novice
graying out text from /* to */
 
Join Date: Aug 2019
Posts: 4
ronnaldo is on a distinguished road
Default

thank you, but maybe i wasn't clear - i want to do this in a VBA Sub
Reply With Quote
  #4  
Old 08-04-2019, 02:58 AM
Guessed's Avatar
Guessed Guessed is offline graying out text from /* to */ Windows 10 graying out text from /* to */ Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 4,159
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

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
Reply With Quote
  #5  
Old 08-04-2019, 07:12 AM
gmaxey gmaxey is offline graying out text from /* to */ Windows 10 graying out text from /* to */ Office 2016
Expert
 
Join Date: May 2010
Location: Brasstown, NC
Posts: 1,599
gmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nice
Default

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
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
Reply With Quote
  #6  
Old 08-04-2019, 10:59 AM
ronnaldo ronnaldo is offline graying out text from /* to */ Windows 7 64bit graying out text from /* to */ Office 2010
Novice
graying out text from /* to */
 
Join Date: Aug 2019
Posts: 4
ronnaldo is on a distinguished road
Default

thank you to all
i will try everything tomorrow
KRs
ron
Reply With Quote
  #7  
Old 08-05-2019, 12:27 AM
ronnaldo ronnaldo is offline graying out text from /* to */ Windows 7 64bit graying out text from /* to */ Office 2010
Novice
graying out text from /* to */
 
Join Date: Aug 2019
Posts: 4
ronnaldo is on a distinguished road
Default

it works !
brill !!!
thanks guys
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
graying out text from /* to */ Text Field [content control] - Default text color vs Filled Text color jackcoletti Word 3 02-01-2017 08:10 AM
graying out text from /* to */ Drawing lines between text boxes which have actual text within the text boxes 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

Other Forums: Access Forums

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