View Single Post
 
Old 05-21-2009, 02:05 AM
Puffin617 Puffin617 is offline Windows XP Office 2003
Novice
 
Join Date: May 2009
Posts: 5
Puffin617 is on a distinguished road
Default

NEW PROBLEM :

The font replacement does not stay within my selected text. It runs past to the end of the document then starts again at the beginning and keeps on in an infinite loop...

Here is my Code so far :

Code:
Private Sub CommandButton1_Click()

        'Application.ScreenUpdating = False
        
        SizeIncrease = TextBox1.Value
        
        If SizeIncrease = "" Then
                End
        End If
        
        Selection.Find.ClearFormatting                  '<------Repeat from here

        With Selection.Find
                .Text = "*"
                .Replacement.Text = ""
                .Forward = True
                .Wrap = wdFindContinue
                .Format = True
                '.Font.Size = 12                                           '<------ Finding a font with size "12"
                .MatchCase = False
                .MatchWholeWord = False
                .MatchWildcards = False
                .MatchSoundsLike = False
                .MatchAllWordForms = False
                .MatchWildcards = True
        End With
    
        While Selection.Find.Execute
                If OptionButton1 = True Then
                        Selection.Font.Size = Selection.Font.Size + SizeIncrease            '<------ Change the Font size
                Else
                        If Selection.Font.Size - SizeIncrease >= 1 Then
                                Selection.Font.Size = Selection.Font.Size - SizeIncrease            '<------ Change the Font size
                        Else
                                Selection.Font.Size = 1            '<------ Change the Font size
                        End If
                End If
        Wend
        
        'Application.ScreenUpdating = False
        
        frmChangeFontSize.Hide
        
End Sub
Attached is the VBA form that I use...

Your help would be appreciated...
Attached Files
File Type: zip frmChangeFontSize.zip (1.5 KB, 16 views)
Reply With Quote