Reputation: 878
I am new to VB. I need to write a VB script for my MS Word macro which would do the following:
The following macro would simply add the arrow I want:
Sub Arrow()
'
' Arrow Macro
'
'
Selection.InsertSymbol Font:="Times New Roman", CharacterNumber:=9658, _
Unicode:=True
End Sub
The arrow symbol I want is like the following:
Can any one help me??
Upvotes: 0
Views: 2199
Reputation: 3311
This is what you can get from Macro Recorder:
Sub Arrow()
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "-->"
.Replacement.Text = ChrW(9658)
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
End Sub
Or you can use an old WordBasic
command:
Sub Arrow()
WordBasic.EditReplace Find:="-->", Replace:=ChrW(9658), Direction:=0, MatchCase:=0, WholeWord:=0, PatternMatch:=0, SoundsLike:=0, ReplaceAll:=1, Format:=0, Wrap:=1
End Sub
Upvotes: 0