This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal


Jan 6, 2017, 6:10 PM
7 Posts

Download a File via VBA

  • Category: Domino Designer
  • Platform: Windows
  • Release: 9.0.1
  • Role: Administrator,Developer
  • Tags:
  • Replies: 1

I'm attempting to use VBA to download a file via a http request.  If I put the myURL value into a browser I get an authentication page, and after login, taken to the file with an "open" prompt.  However, when I use this code, all I get is a file with the Domino Login page in it.

Has anyone done this or something similar?  Any ideas or other ways of doing this?  Help?  Thoughts?

Thank you for looking, and thank you for your help and advise.

VBA CODE:

Sub DownloadFile()

Dim myURL As String
myURL = "http://192.168.0.2/P&P/pp681Dev.nsf/0/84e8316d0287db8787257ead0058ae62/$FILE/PNPTempWord.doc"

Dim WinHttpReq As Object
Set WinHttpReq = CreateObject("Microsoft.XMLHTTP")
WinHttpReq.open "GET", myURL, False, "username", "password"
WinHttpReq.Send

myURL = WinHttpReq.ResponseBody
If WinHttpReq.Status = 200 Then
    Set oStream = CreateObject("ADODB.Stream")
    oStream.open
    oStream.Type = 1
    oStream.Write WinHttpReq.ResponseBody
    oStream.SaveToFile "C:\Temp\PNPTempWord.doc", 2 ' 1 = no overwrite, 2 = overwrite
    oStream.Close
End If

End Sub

Jan 11, 2017, 3:03 PM
323 Posts
Well, it sounds like you may need to login to get access to the file.

You could login (or have VBA login) separately, then try to retrieve the file.

Clearly the "GET" submittal isn't satisfying the login request.

Alternatively, you might grant "Anonymous" access to the server, DB, and file. It'd defeat securing the file from any prying eyes, though.


This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal