-
Missing Key Word
Take a look at the following code
Code:
Function addtagID(source As String, kw1 As String)
Dim i As Integer
i = 0
Word.Selection.SetRange 0, 0
While (Word.Selection.Find.Execute(source, False, False, False, False, False, True, wdFindStop, True))
i = i + 1
si = Right(i + 100000, 2)
sii = Right(i + 100000, 3)
Word.Selection.Text = (kw1 & sii)
Word.Selection.Start = Word.Selection.Start + Len(Word.Selection.Text)
Wend
If i = 0 Then MsgBox "Keyword Not Found"
End Function
i call the function using
Code:
Sub addtagi()
s = addtagID("sec1-####", "sec1-")
End Sub
its supposed to search for the string "sec1-####" and replace it with an index number like this sec1-001.
But when i execute the word macro, the find isnt working and it just displays keyword not found