The following macro displays a dialog box that lets the user enter a number
in order to indicate which text effect to apply. It could be made a bit more
elegant by creating a UserForm but this version works (more checks for
inappropriate selection could be included). The macro could be added to the
QAT:
Sub ApplyTextEffect()
Dim strInput As String
Dim Msg As String
Dim Title As String
Title = "Apply Text Effect to Selected Text"
'Stop if no selection or only paragraph mark selected
If Selection.Type = wdSelectionIP Or Selection.Text = Chr(13) Then
Msg = "You must first select the text to which you want to apply a
text effect."
MsgBox Msg, vbInformation, Title
Exit Sub
End If
Retry:
Msg = "Enter the number of the text effect you want to apply:" & vbCr &
vbCr & _
"0: None (remove text effect)" & vbCr & _
"1: Blinking Background" & vbCr & _
"2: Las Vegas Lights" & vbCr & _
"3: Marching Black Ants" & vbCr & _
"4: Marching Red Ants" & vbCr & _
"5: Shimmer" & vbCr & _
"6: Sparkle Text"
strInput = InputBox(Msg, Title)
If Len(strInput) = 0 Then
If StrPtr(strInput) = 0 Then
'Cancel clicked
Exit Sub
Else
'OK clicked, empty field
ShowMsg:
Msg = "You must enter a number between 0 and 6. Please retry."
MsgBox Msg, vbInformation, Title
GoTo Retry
End If
Else
'Input
'If not an integer between 0 and 6
If Len(strInput) <> 1 Or InStr(1, "0123456", strInput) = 0 Then
GoTo ShowMsg
Else
With Selection.Font
Select Case strInput
Case 0
.Animation = wdAnimationNone
Case 1
.Animation = wdAnimationBlinkingBackground
Case 2
.Animation = wdAnimationLasVegasLights
Case 3
.Animation = wdAnimationMarchingBlackAnts
Case 4
.Animation = wdAnimationMarchingRedAnts
Case 5
.Animation = wdAnimationShimmer
Case 6
.Animation = wdAnimationSparkleText
End Select
End With
End If
End If
End Sub
--
Regards
Lene Fredborg - Microsoft MVP (Word)
DocTools - Denmark
www.thedoctools.com
Document automation - add-ins, macros and templates for Microsoft Word