I am using VBA to control the internet explorer, and in my case I need to realize the function of click a boutton on the website. Below is the structure HTML of the website, and the blue line is just the place where I want to click. I have written some basic code. However it comes an error at the line Set Bton2 = Bton1.Children(4).Children(1) "Object variable or With block variable not set". i have also tried some ither ways for I have found some possible position of the line by "Watch", like
Set Test = Bton1.contentDocument.DocumentElement.all(9)
But it says no such a methode or property. Any advice and solution is welcome. Thanks in advance.
Sub openPdf()
Dim IE As New InternetExplorerMedium
Dim IEDoc As HTMLDocument
Dim Bton1 As Object
Dim Bton2 As Object
IE.Navigate "http://dcv.xxx.xxxx" 'Remplacer par le site de DocPriv ici
IE.Visible = True
Do
Loop Until Not (IE.Busy)
Set IEDoc = IE.document
Set Bton1 = IEDoc.all("frmSommaire1")
Set Bton2 = Bton1.Children(4).Children(1)
Bton1.Children(1).Children(0).Children(9).Children(0).Click
Do
Loop Until Not (IE.Busy)
etc
