I am Getting error while automating an existing IE window. error is
"Object Variable or with block variable not set" Code is
Sub accessExistingIEBrowser()
boolWindowFound = False
Set objShell = CreateObject("Shell.Application")
WinCount = objShell.Windows.Count
For winNo = 0 To (WinCount - 1)
strURL = objShell.Windows(winNo).document.Location
strTitle = objShell.Windows(winNo).document.Title
If strTitle Like "Sample Form" Then
Set IE = objShell.Windows(winNo)
boolWindowFound = True
Exit For
Else
End If
Next
If boolWindowFound Then
Set doc = IE.document
doc.getElementsByName("fname")(0).Value = "test"
End If
End Sub