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

Re: Bold formatting by Greg

Greg
Sat Nov 13 13:51:56 CST 2004

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



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

Sajja wrote:
> 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



Re: Bold formatting by Sajja

Sajja
Sat Nov 13 14:40:01 CST 2004

Thanks a lot Greg, it worked.

"Greg Maxey" wrote:

> 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
>
>
>
> --
> Greg Maxey/Word MVP
> A Peer in Peer to Peer Support
>
> Sajja wrote:
> > 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
>
>
>