VBA Internet Explorer Unable to click "Export" Button.

CCL

New Member
Joined
Jan 15, 2021
Messages
1
Office Version
  1. 365
Platform
  1. Windows
Hi,

I am trying to click the export button by ID ("exportRpt") but nothing happen in the IE. Is there anything that I have missed?

1610701839496.png


I have written a code to loop through each IE and find the new IE that I am going to work with.

here is my Macro code:

Sub Third_Level()

Dim TWB As Workbook
Set TWB = ThisWorkbook
Dim target As String
Dim IE As InternetExplorer

target = "URL (Deleted Due to confidentiality")

Set objshell = CreateObject("Shell.Application")
IE_Count = objshell.Windows.Count

For x = 0 To (IE_Count - 1)
On Error Resume Next ' sometimes more web pages are counted than are open
My_url = objshell.Windows(x).LocationURL
My_Title = objshell.Windows(x).document.Title

If My_url = target Then 'compare to find if the desired web page is already open
Set IE = objshell.Windows(x)
Exit For

End If

Next


Dim DOC As HTMLDocument
Set DOC = IE.document

Dim IDTAG3 As IHTMLElement
Set IDTAG3 = DOC.getElementById("exportRpt")

IDTAG3.Click

End Sub


Thank in advance!.
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off

Forum statistics

Threads
1,224,820
Messages
6,181,159
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top