Execution of URLDownloadToFile function returns E_ACCESSDENIED General access denied error 0x80070005 on corporate network

3

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?

vba
excel-vba
internet-explorer
winapi
excel
asked on Stack Overflow Jul 2, 2014 by StandardDeviation • edited Jul 9, 2018 by Community

1 Answer

0

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)
answered on Stack Overflow Feb 9, 2018 by Andre

User contributions licensed under CC BY-SA 3.0