Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / November 2004

Tip: Looking for answers? Try searching our database.

Bold formatting

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Sajja - 13 Nov 2004 19:33 GMT
Hi,

I would like to format text to bold which comes in between two special
characters, say all the text between # and * as in below .

word document formatting # is easy if you know * macro coding.

Please provide me a code snippet for this as I'm new to VBA code.

Thanks in advance.
Sajja
Greg Maxey - 13 Nov 2004 19:51 GMT
Something like this:

Sub FindAndBoldTextBetweenSpecCharacters()

Dim oRng As Range
Set oRng = ActiveDocument.Content

With oRng.Find
 .ClearFormatting
 .Text = "#<*>[/*]"
 .Forward = True
 .Wrap = wdFindStop
 .MatchWildcards = True
 Do While .Execute
   With oRng
     .Font.Bold = True
     .Collapse wdCollapseEnd
   End With
 Loop
End With
End Sub

Signature

Greg Maxey/Word MVP
A Peer in Peer to Peer Support

> Hi,
>
[quoted text clipped - 7 lines]
> Thanks in advance.
> Sajja
Sajja - 13 Nov 2004 20:40 GMT
Thanks a lot Greg, it worked.

> Something like this:
>
[quoted text clipped - 29 lines]
> > Thanks in advance.
> > Sajja
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.