Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
Word
application.errors
conversions
docmanagement
drawing.graphics
formatting.longdocs
international
internet.assistant
mail
mailmerge.fields
menustoolbars
newusers
numbering
oleinterop
pagelayout
printingfonts
setup.networking
spelling.grammar
tables
vba.addins
vba.beginners
vba.customization
vba.general
vba.userforms
web.authoring
word6-7macros
word97vba
  
 
date: Tue, 9 Sep 2008 16:35:48 -0700 (PDT),    group: microsoft.public.word.vba.beginners        back       


Macro to format text between square brackets and text with in braces   
Hello,

I am a word macro neophyte at best.

What I would like is a macro that would:
 bold, font size =14, font color = blue all text between square
brackets [ ]  and put all text between braces, { } to font size 10,
italics, color=red.   Any direction would be appreciated.  Thank-you.

JB
date: Tue, 9 Sep 2008 16:35:48 -0700 (PDT)   author:   jb

Re: Macro to format text between square brackets and text with in braces   
Sub ScratchMacro()
Dim oRng As Range
Set oRng = ActiveDocument.Content
With oRng.Find
  .ClearFormatting
  .Text = "\[*\]"
  .Forward = True
  .Wrap = wdFindStop
  .MatchWildcards = True
  Do While .Execute
    With oRng
      .MoveEnd unit:=wdCharacter, Count:=-1
      .MoveStart unit:=wdCharacter, Count:=1
      .Font.Color = wdColorBlue
      .Font.Bold = True
      .Font.Size = "14"
      .Collapse wdCollapseEnd
    End With
  Loop
End With
Set oRng = ActiveDocument.Content
With oRng.Find
  .ClearFormatting
  .Text = "\{*\}"
  .Forward = True
  .Wrap = wdFindStop
  .MatchWildcards = True
  Do While .Execute
    With oRng
      .MoveEnd unit:=wdCharacter, Count:=-1
      .MoveStart unit:=wdCharacter, Count:=1
      .Font.Color = wdColorRed
      .Font.Italic = True
      .Font.Size = "10"
      .Collapse wdCollapseEnd
    End With
  Loop
End With
End Sub

-- 
Greg Maxey -  Word MVP

My web site http://gregmaxey.mvps.org
Word MVP web site http://word.mvps.org
"jb"  wrote in message 
news:44069e8a-c22d-4f5d-b40b-4d7b5599b4d5@f63g2000hsf.googlegroups.com...
> Hello,
>
> I am a word macro neophyte at best.
>
> What I would like is a macro that would:
> bold, font size =14, font color = blue all text between square
> brackets [ ]  and put all text between braces, { } to font size 10,
> italics, color=red.   Any direction would be appreciated.  Thank-you.
>
> JB
date: Tue, 9 Sep 2008 19:59:03 -0400   author:   Greg Maxey RrOMEOgOLF

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us