![]() |
|
|
|
#1
|
|||
|
|||
|
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
Your help would be appreciated... |
|
#2
|
||||
|
||||
|
Try putting the While - Wend statement inside the If statement rather than around it
Code:
If OptionButton1 = True Then
While Selection.Find.Execute
Selection.Font.Size = Selection.Font.Size + SizeIncrease
Wend
Else
>ETC,ETC,ETC<
|
|
#3
|
|||
|
|||
|
Hey,
NO-GO... 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
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
.MatchWildcards = True
End With
If OptionButton1 = True Then
While Selection.Find.Execute
Selection.Font.Size = Selection.Font.Size + SizeIncrease
Wend
Else
While Selection.Find.Execute
Selection.Font.Size = Selection.Font.Size - SizeIncrease
Wend
End If
'Application.ScreenUpdating = False
frmChangeFontSize.Hide
End Sub
A thought : What does the ".wrap" in the find do? |
|
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
Type spacing and point sizes in Word
|
funky | Word | 3 | 01-14-2009 09:18 PM |
Font colors
|
JerryB | Excel | 1 | 11-30-2008 10:23 AM |
| need help with font color | samsongee | Word | 0 | 09-07-2006 10:18 PM |
| IRR with Changing Signs | aml480 | Excel | 0 | 03-16-2006 11:27 PM |
Font Problem with Richtextbox in MS Access Report
|
surendrababu | Office | 2 | 11-29-2005 02:11 AM |