I have an extensive VBA macro in Excel that is used to open a IE URL and download the page. It uses CreateObject("InternetExplorer.Application")
and the URLDownloadToFile
function of "urlmon". The purpose of this macro is to do the following:
Takes the URLs from the Export sheet, calls SSRS (Reporting Services) to display the report, and downloads the report to a file with the path and name provided on the Export sheet. This results in a set of files, one for each report, with parameters, chart, and data table in the file.
Here are the relative code snippets from the macro:
If Cells(ActiveCell.row, 3).Value = "" Then
Call IE_Automation0(URL & "&rs:Command=Render&rs:Format=EXCEL&rc:Toolbar=false", Cells(7, 9).Value + IIf(Right(Cells(7, 9).Value, 1) = "\", "", "\") + Cells(ActiveCell.row, 2).Value) ' change 20120327
Else
Call IE_Automation0(URL & "&rs:Command=Render&" & theFormat & "&rc:Toolbar=false", Cells(ActiveCell.row, 3).Value + IIf(Right(Cells(ActiveCell.row, 3).Value, 1) = "\", "", "\") + Cells(ActiveCell.row, 2).Value) ' change 20120327
End If
The following is in the IE_Automation0:
' Create InternetExplorer Object
Set IE = CreateObject("InternetExplorer.Application")
' Send the form data To URL As POST binary request
IE.Navigate theURL
Call downloadFile(theURL, theSaveAsFilename + theExtenstion) ' download the SSRS file and save it
This is in the downloadFile function which calls the URLDownloadToFile function of urlmon:
returnVal = URLDownloadToFile(0, target, strSavePath, 0, 0)
What do I need to do to change my code so that I can do the same functions but using Edge, Chrome, or Firefox due to IE being removed in June of 2022.