how do i debug my program? error description "Run time error '91':" Object variable or With block variable not set
Here is my Code:
VB Code:
Private Sub Command1_Click() Dim objWdApp As Word.Application Dim objWdRange As Word.Range Dim objWdDoc As Word.Document Dim count As Integer Dim wdText As String count = 0 wdText = Text1.Text Set objWdRange = objWdDoc.Content With objWdRange.Find Do While .Execute(FindText:=wdText, Format:=False) = True count = count + 1 Loop End With MsgBox "There are " & count + "words", vbInformation Set objWdRange = Nothing End Sub
your help is very much appreciated. thanks in advance.




Reply With Quote