Update # 2
I changed the values of the txtbox and submitbtns with a (0)
(and also tried (1)
as well), no changes.
And I also need to note that the Button has a different name and I updated accordingly here as well.
Dim TBox As String 'Name of object textbox to have value changed in
Dim TBtn As String 'Name of object button to be pressed
TBox = "masked1"
TBtn = "button"
If Not IE Is Nothing Then
Set txtBox = IE.Document.getElementsByClassName(TBox)(0)
Set submitBtn = IE.Document.getElementsByClassName(TBtn)(0)
txtBox.Value = tVal
submitBtn.Click
End If
UPDATE # 1
So, things look promising with the suggestion provided by @cyboashu. However, I still cannot get my txtbox to update to the value = tVal
(String).
Dim oShell As Object
Dim oWin As Object
Dim IE As Object
Dim lTotlWin As Long
Dim lCtr
Debug.Print Time & " --- IE Objects & Values ---" ' Debugger Section
Set oShell = CreateObject("Shell.Application")
Debug.Print Time & " [obj ] oShell..: " & oShell ' Debug oShell
Set oWin = oShell.Windows()
Debug.Print Time & " [obj ] oWin....: " & oWin ' Debug oWin
lTotlWin = oWin.Count - 1 '/ Starts with zero
Debug.Print Time & " [long] lTotlWin: " & lTotlWin ' Debug lTotlWin
For lCtr = 0 To lTotlWin
If UCase(oWin.Item(lCtr).FullName) Like "*IEXPLORE.EXE" Then
Set IE = oWin.Item(lCtr)
End If
Next
Debug.Print Time & " [obj ] IE......: " & IE
If Not IE Is Nothing Then
MsgBox "Found and hooked!!"
End If
Dim TBox As String 'In the event the textbox's name changes for some reason
TBox = "masked1"
If Not IE Is Nothing Then
Set txtBox = IE.Document.getElementsByClassName(TBox)
Debug.Print Time & " [obj ] txtbox..: " & txtbox
Set submitBtn = IE.Document.getElementsByClassName(TBox)
Debug.Print Time & " [obj ] submitBtn:" & submitBtn
txtBox.Value = tVal
submitBtn.Click
End If
Set shellwins = Nothing
Debug.Print Time & "- - - END SUB - - -" & E
End Sub
(Debugger values if anyone cares)..
2:44:11 PM --- IE Objects & Values ---
2:44:11 PM [long] lTotlWin: 5
2:44:11 PM [obj ] IE......: Internet Explorer
2:44:11 PM - - - END SUB - - -