JumboCactuar
Well-known Member
- Joined
- Nov 16, 2016
- Messages
- 788
- Office Version
- 365
- Platform
- Windows
Hi,
never seen anything like this before:
I insert this code into a blank workbook, and attempt to save as XLSM or XLSB and it just fails
Any idea why?
Thanks
never seen anything like this before:
I insert this code into a blank workbook, and attempt to save as XLSM or XLSB and it just fails
VBA Code:
Sub DownloadFile()
Dim myURL As String
myURL = "https:\\urltofile.com\A"
FPath = "C:\CSV\"
If Dir(FPath, vbDirectory) = "" Then MkDir FPath
FName = "Filedownload.CSV"
Dim WinHttpReq As Object
Set WinHttpReq = CreateObject("Microsoft.XMLHTTP")
WinHttpReq.Open "GET", myURL, False
WinHttpReq.send
If WinHttpReq.Status = 200 Then
Set oStream = CreateObject("ADODB.Stream")
oStream.Open
oStream.Type = 1
oStream.Write WinHttpReq.responseBody
oStream.SaveToFile FPath & FName, 2 ' 1 = no overwrite, 2 = overwrite
oStream.Close
End If
End Sub
Any idea why?
Thanks