Smithy02468
New Member
- Joined
- Aug 4, 2013
- Messages
- 13
I am accessing a website via excel vba the login process works ok and then produces a HTML table with one row which requires that i click on the cell with North_Yorkshire to enter the website.
below is the source code for this cell,
<DIV class="x-grid3-cell-inner x-grid3-col-Name" unselectable="on">NORTH_YORKSHIRE</DIV>
Private Sub CommandButton2_Click()
Dim MyHTML_Element As IHTMLElement
Dim Myurl As String
Dim HTMLDoc As MSHTML.HTMLDocument
Dim HTMLInput As MSHTML.IHTMLElement
On Error GoTo Err_Clear
Myurl = "***********************"
Set MyBrowser = New InternetExplorer
MyBrowser.Silent = True
MyBrowser.navigate Myurl
MyBrowser.Visible = True
Do
Loop Until MyBrowser.readyState = READYSTATE_COMPLETE
Set HTMLDoc = MyBrowser.Document
'Checkbox
Set HTMLInput = HTMLDoc.getElementById("chkTermsAndCond")
HTMLInput.Click
'Log in button press
Set HTMLInput = HTMLDoc.getElementById("btnContinue")
HTMLInput.Click
Application.Wait (Now + TimeValue("0:00:05"))
'Login Form
Set HTMLInput = HTMLDoc.getElementById("Username")
HTMLInput.Value = ThisWorkbook.Sheets("Stats").Range("C16").Value
Set HTMLInput = HTMLDoc.getElementById("Password")
HTMLInput.Value = ThisWorkbook.Sheets("Stats").Range("E16").Value
HTMLDoc.getElementById("ext-gen27").Click
'HTML Table
HTMLDoc.getElementsByName("x-grid3-cell-inner x-grid3-col-Name") = "NORTH_YORKSHIRE"
Set HTMLTables = HTMLDoc.getElementsByTagName("")
'Tried using it seems to pause then does nothing
'HTMLDoc.getElementsByClassName("x-grid3-cell-inner x-grid3-col-Name") = "NORTH_YORKSHIRE"
'HTMLInput.Click
Err_Clear:
If Err <> 0 Then
Err.Clear
Resume Next
End If
End Sub
any ideas ?
Thanks in advance for any help
Colin
below is the source code for this cell,
<DIV class="x-grid3-cell-inner x-grid3-col-Name" unselectable="on">NORTH_YORKSHIRE</DIV>
Private Sub CommandButton2_Click()
Dim MyHTML_Element As IHTMLElement
Dim Myurl As String
Dim HTMLDoc As MSHTML.HTMLDocument
Dim HTMLInput As MSHTML.IHTMLElement
On Error GoTo Err_Clear
Myurl = "***********************"
Set MyBrowser = New InternetExplorer
MyBrowser.Silent = True
MyBrowser.navigate Myurl
MyBrowser.Visible = True
Do
Loop Until MyBrowser.readyState = READYSTATE_COMPLETE
Set HTMLDoc = MyBrowser.Document
'Checkbox
Set HTMLInput = HTMLDoc.getElementById("chkTermsAndCond")
HTMLInput.Click
'Log in button press
Set HTMLInput = HTMLDoc.getElementById("btnContinue")
HTMLInput.Click
Application.Wait (Now + TimeValue("0:00:05"))
'Login Form
Set HTMLInput = HTMLDoc.getElementById("Username")
HTMLInput.Value = ThisWorkbook.Sheets("Stats").Range("C16").Value
Set HTMLInput = HTMLDoc.getElementById("Password")
HTMLInput.Value = ThisWorkbook.Sheets("Stats").Range("E16").Value
HTMLDoc.getElementById("ext-gen27").Click
'HTML Table
HTMLDoc.getElementsByName("x-grid3-cell-inner x-grid3-col-Name") = "NORTH_YORKSHIRE"
Set HTMLTables = HTMLDoc.getElementsByTagName("")
'Tried using it seems to pause then does nothing
'HTMLDoc.getElementsByClassName("x-grid3-cell-inner x-grid3-col-Name") = "NORTH_YORKSHIRE"
'HTMLInput.Click
Err_Clear:
If Err <> 0 Then
Err.Clear
Resume Next
End If
End Sub
any ideas ?
Thanks in advance for any help
Colin