Hi guys,
I'm currently writing a word VBA and I have ran into problems.
My macro is supposed to search for the word "Forms" and select all the text until it reaches the word "Mixing".
Attached is a image and my source code, I'm new to VBA and would appreciate it if someone could help me.
Thanks :thanx:
[Blocked Image: http://img217.exs.cx/img217/7776/untitled5vh.jpg]
Code
Private Sub CommandButton1_Click()
'find the word "forms"
Selection.HomeKey
Selection.Find.ClearFormatting
With Selection.Find
.Text = "forms"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute
End Sub
Private Sub CommandButton2_Click()
'select until "Mixing" is found
While Selection.Find.Text <> "Mixing"
Selection.MoveRight Unit:=wdWord, Count:=1, Extend:=wdExtend
Wend
End Sub
Display More