L
Lucas
I need to search for the second occurrence in my document
of whatever the value of the first line happens to be.
I'm unsure how to get With.Selection.Find.Text to use a
value from a string that I've set earlier in the macro.
Is this even possible?
Thanks in advance.
Sub Whatever()
Dim Company As String
Selection.HomeKey Unit:=wdStory
Selection.EndKey Unit:=wdLine, Extend:=wdExtend
Company = Selection
MsgBox Company, vbOKOnly, "blah"
Selection.EndKey Unit:=wdLine
Selection.Find.ClearFormatting
With Selection.Find
.Text = Company
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
End Sub
of whatever the value of the first line happens to be.
I'm unsure how to get With.Selection.Find.Text to use a
value from a string that I've set earlier in the macro.
Is this even possible?
Thanks in advance.
Sub Whatever()
Dim Company As String
Selection.HomeKey Unit:=wdStory
Selection.EndKey Unit:=wdLine, Extend:=wdExtend
Company = Selection
MsgBox Company, vbOKOnly, "blah"
Selection.EndKey Unit:=wdLine
Selection.Find.ClearFormatting
With Selection.Find
.Text = Company
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
End Sub