• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

IE (Internet Explorer) Automation using Excel VBA - Click and Checkbox

Ramesh OK

New Member
I am using excel vba to fill IE details, not able to find the vba code to check the checkbox and click the image (img src) button. I have attached the IE source code.

i tried many vba codes but not able get it right.

following code which i tried.

Code:
'text 1

Set ElementCol = appIE.Document.getElementsByName("Button")

For Each btnInput In ElementCol
  If btnInput.Value = "Button_Name" Then
  btnInput.Click
  Exit For
  End If
Next btnInput

'text 2

Dim inputElements As Object
Dim inputElement As IHTMLElement
Set inputElements = appIE.Document.getElementsByTagName("TR")

For Each inputElement In inputElements
If inputElement.className = "shadedRow" Then
inputElement.Click
GoTo a
End If
Next inputElement

'text 3

Set objButton = ie.Document.getElementById("btnExample")
  objButton.onfocus
  objButton.onclick

'text 4
Set objIMG = Doc.images("SubmitRus")
  Set objAnchor = objIMG.parentElement
  objAnchor.Click

'text 5
Set btnLogin = Doc.getElementById("xxxxx")
  btnLogin.Click

'text
  ie.Document.all.Item("login_submit").Click
'text 1a
Set btn = Doc.getElementById("fpoByReverseSearch:fpoSearch:j_id184")
  'input postal code
  PostalCodeBox.Value = "BOH 1AO"
  btn.Click
 
Last edited by a moderator:

First, edit your post to put code between tags according to forum rules.

Seems you don't try to click on a form's item …
See threads in the right forum devolute to VBA, here it's for cells formula.

Sometimes webpages are protected but without a link to the webpage …
 
Hi Ramesh,

I had edited your thread and also moved it to proper section.

EDIT: Can you tell the link which you are trying to access so that somebody can help you out here.



Regards,
 
Last edited:
Thank you Somendra for editing and moved it to proper section. While posing next time i will make sure to correct section.

Finally able to get the correct one.

Set btnLogin = Doc.getElementById("xxxxx")
btnLogin.Click

"xxxxx" i was trying with img name, but when i tried table as "xxxxx" this clicked correctly.
 
Back
Top