Environment: MS Windows Server 2003, IE9, MS Excel 2007.
Prerequisite: A user logs on to the server using a username and a password. When accessing internet through IE9 (or any other web browser) a dialog box is displayed requiring the username and the password (required by the server at Kerio Winroute Firewall).
Scenario: A user runs URLDownloadToFile function from Excel to download a .pdf file from the internet, function returns error E_ACCESSDENIED.
Question: How to execute file download from internet using URLDownloadToFile function from Excel without errors in the abovementioned scenario?
Old question, but one of the top Google hits for this problem.
I had to use a valid domain user name & password in the URL, like this:
sURL = "https://username:password@server.mydomain.com/path/file.pdf"
ret = URLDownloadToFile(0, sURL, sLocalFile, 0, 0)
User contributions licensed under CC BY-SA 3.0