I have this procedure to insert value to IE form but not working. The procedure is
Sub InsertValue()
Dim IE As Object
Dim doc As HTMLDocument
Dim objShell As Object
Dim str_val1 As HTMLInputElement
Dim i, A As Double
marker = 0
Set objShell = CreateObject("Shell.Application")
Dim btnGo As Object
Dim frm As Object
Dim test As Worksheet
Set test = ActiveSheet
Dim dom_tags As Object
Dim tag As Object
Set IE = CreateObject("InternetExplorer.Application")
y = 65
Application.Wait (Now + TimeValue("00:00:02"))
Set objAllWindows = objShell.Windows
IE_count = objShell.Windows.Count
For Each ow In objAllWindows
If (InStr(1, ow, "Internet Explorer", vbTextCompare)) Then
test.Range("A" & y) = ow
test.Range("B" & y) = ow.hwnd
test.Range("C" & y) = ow.document.Title
test.Range("D" & y) = ow.LocationURL
y = y + 1
If test.Cells(y - 1, 3).Value Like "Legal of - " & "*" Then
Set IE = objShell.Windows((y - 65))
Set doc = IE.document
marker = 1
Exit For
Else
End If
End If
Next
If marker = 0 Then
MsgBox ("A matching webpage was NOT found")
Else
MsgBox ("A matching webpage was found")
Set str_val1 = doc.getElementById("fieldName:COLLATERAL.TYPE")
str_val1.Value = test.Cells(i + 2, 12).Value <===================error 91
End If
End Sub
so many thanks for help this problem
Sub InsertValue()
Dim IE As Object
Dim doc As HTMLDocument
Dim objShell As Object
Dim str_val1 As HTMLInputElement
Dim i, A As Double
marker = 0
Set objShell = CreateObject("Shell.Application")
Dim btnGo As Object
Dim frm As Object
Dim test As Worksheet
Set test = ActiveSheet
Dim dom_tags As Object
Dim tag As Object
Set IE = CreateObject("InternetExplorer.Application")
y = 65
Application.Wait (Now + TimeValue("00:00:02"))
Set objAllWindows = objShell.Windows
IE_count = objShell.Windows.Count
For Each ow In objAllWindows
If (InStr(1, ow, "Internet Explorer", vbTextCompare)) Then
test.Range("A" & y) = ow
test.Range("B" & y) = ow.hwnd
test.Range("C" & y) = ow.document.Title
test.Range("D" & y) = ow.LocationURL
y = y + 1
If test.Cells(y - 1, 3).Value Like "Legal of - " & "*" Then
Set IE = objShell.Windows((y - 65))
Set doc = IE.document
marker = 1
Exit For
Else
End If
End If
Next
If marker = 0 Then
MsgBox ("A matching webpage was NOT found")
Else
MsgBox ("A matching webpage was found")
Set str_val1 = doc.getElementById("fieldName:COLLATERAL.TYPE")
str_val1.Value = test.Cells(i + 2, 12).Value <===================error 91
End If
End Sub
so many thanks for help this problem