Results 1 to 4 of 4
  1. #1
    4 Star Lounger
    Join Date
    Jan 2002
    Location
    London, Gtr London, England
    Posts
    416
    Thanks
    0
    Thanked 0 Times in 0 Posts

    font size change in TEXTBOXES (WORD 97/2000/...)

    Hi,

    Thought this would have been covered previously but could not find anything on. I need to have a macro that replaces the font size in a text box to a smaller size for a paragraph with particular style.

    1. If I do the replacement as part of my editing (i.e. Ctrl+H), select find style, select replacement style, select replacement font size & click 'Replace All' - it works changes the font sizes in the text boxes to the required size.

    2. If I record the above action and run it as part of a macro - it DOESN'T do the replacement.
    3. If I use range instead of selection - it still DOESN'T do the replacement.

    Any ideas. The selection code is as follows:

    Sub ReplaceFlashInfoFont()

    Selection.Find.ClearFormatting
    Selection.Find.Style = ActiveDocument.Styles("FlashInfo")
    Selection.Find.ParagraphFormat.Borders.Shadow = False
    Selection.Find.Replacement.ClearFormatting
    Selection.Find.Replacement.Style = ActiveDocument.Styles("FlashInfo")
    Selection.Find.Replacement.Font.Size = 8
    Selection.Find.Replacement.ParagraphFormat.Borders .Shadow = False
    With Selection.Find
    .Text = ""
    .Replacement.Text = ""
    .Forward = True
    .Wrap = wdFindContinue
    .Format = True
    .matchCase = False
    .MatchWholeWord = False
    .MatchWildcards = False
    .MatchSoundsLike = False
    .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll
    End Sub

    Thanks for the info. Robie.
    Thanks.
    Robie

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 16 Times in 16 Posts

    Re: font size change in TEXTBOXES (WORD 97/2000/...)

    1. Why not modify the style? (interactively or in code)

    2. Try removing the lines
    Selection.Find.ParagraphFormat.Borders.Shadow = False
    and
    Selection.Find.Replacement.ParagraphFormat.Borders .Shadow = False

  3. #3
    4 Star Lounger
    Join Date
    Jan 2002
    Location
    London, Gtr London, England
    Posts
    416
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: font size change in TEXTBOXES (WORD 97/2000/...)

    Thanks for the response Hans.

    Number 2 suggestion changes didn't make any difference.

    Number 1 suggestion: I tried that through code - no difference. The code being Activedocument.Styles("FlashInfo").Font.Size= 8.

    Just to clarify: The problem arises in several documents that have hundred of text boxes with the font size of 12 - too big and they need to be smaller, i.e. 8. This needs to be done though code.

    Thanks.

    Robie
    Thanks.
    Robie

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 16 Times in 16 Posts

    Re: font size change in TEXTBOXES (WORD 97/2000/...)

    Does this work?

    Sub ReplaceFlashInfoFont()
    Dim sh As Shape
    For Each sh In ActiveDocument.Shapes
    If sh.Type = msoTextBox Then
    With sh.TextFrame.TextRange.Find
    .Text = ""
    .ClearFormatting
    .Style = ActiveDocument.Styles("FlashInfo")
    .Replacement.Text = ""
    .Replacement.ClearFormatting
    .Replacement.Font.Size = 8
    .Forward = True
    .Wrap = wdFindStop
    .MatchCase = False
    .MatchWholeWord = False
    .MatchWildcards = False
    .MatchSoundsLike = False
    .MatchAllWordForms = False
    .Execute Replace:=wdReplaceAll
    End With
    End If
    Next sh
    End Sub

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •