1

Web page interface

Code for the first image

Hello guys, I need to check the box on a webpage that is shown in the first image and the get element by ID method does not work in this case: ie.document.getElementById("exportFormatGrids_excelFormattingGridsIServer").Click

How can I check the box? Also, in the second image is the code for the "Excel with formatting" box

The complete code that I use is:

    Dim ie As Object
Dim objClass As Object
Dim ObjPage As Object
Dim objButton As Object

Dim ThsWb As Workbook
Dim ThsSh As Worksheet

Set ThbWs = ThisWorkbook
Set ThSh = ThbWs.Sheets("TgsUmsRep")

Dim RepLnk As String
Dim StrDate As String
Dim EndDate As String

RepLnk = ThSh.Range("D9")
StrDate = ThSh.Range("D11")
EndDate = ThSh.Range("D12")


   Set ie = New InternetExplorerMedium
       ie.Visible = True
         ie.Navigate2 RepLnk   'RepLnk = https://mis.lidl.net/MicroStrategy/servlet/mstrWeb?Server=L-MIS03&Project=MIS+International&Port=0&evt=4001&src=mstrWeb.4001&visMode=0&reportViewMode=1&reportID=9E1E8C7111E700DF00000080EFA5F88E&reportSubtype=768

         Do While ie.Busy
            Application.Wait DateAdd("s", 1, Now)
         Loop

delay 3
ie.document.getElementById("id_mstr39_txt").Value = StrDate

delay 3
ie.document.getElementById("id_mstr46_txt").Value = EndDate

delay 3
ie.document.getElementById("id_mstr64").Click

delay 3
ie.document.getElementById("tbExport").Click

delay 3
ie.document.getElementById("exportFormatGrids_excelFormattingGridsIServer").Click    'This is where I get to the part that the pictures show and where the problem is

Thank you in advance!

Aderon
  • 43
  • 8
  • You should share your code, not images. – Takit Isy Apr 26 '18 at 07:05
  • Could you please share the webpage URL? You may opt to XHR to download exported Excel workbook, instead of IE automation. – omegastripes Apr 26 '18 at 07:23
  • Added the code and the URL. Once I open the Web page, I get a report and afterwards I press a download button via "getelementbyid.click" which leads me to the part that the pictures show – Aderon Apr 26 '18 at 08:03
  • Check 1) browser state `IE.ReadyState`, `IE.Busy`, then 2) document state `IE.document.readyState`, and 3) target node availability `IsNull(.document.getElementById("..")`. Here are some examples [1](https://stackoverflow.com/a/36070812/2165759), [2](https://stackoverflow.com/a/37244098/2165759), [3](https://stackoverflow.com/a/43969543/2165759), [4](https://stackoverflow.com/a/41771309/2165759). – omegastripes Apr 26 '18 at 10:40

1 Answers1

0

Try using attribute checked:

ie.document.getElementById("exportFormatGrids_excelFormattingGridsIServer").checked = true;