ie.Navigate save file to folder?

JumboCactuar

Well-known Member
Joined
Nov 16, 2016
Messages
685
Hi,
I managed to login to site then navigate to specific URL which is a JSON

After loading the page, a prompt comes up to open/save JSON

Is there a way I can save this to a specific folder with VBA?
 

Some videos you may like

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.

Worf

Well-known Member
Joined
Oct 30, 2011
Messages
4,003
This example shows how to download a text file without Internet Explorer:

Code:
Sub DloadFile()
Dim ostream, wreq As Object
Set wreq = CreateObject("Microsoft.XMLHTTP")
wreq.Open "GET", "https://raw.githubusercontent.com/jdorfman/" & _
"awesome-json-datasets/master/tests/relaxed.json", False
wreq.send
If wreq.Status = 200 Then
    Set ostream = CreateObject("ADODB.Stream")
    ostream.Open
    ostream.Type = 1
    ostream.Write wreq.responseBody
    ostream.SaveToFile "C:\pub\file.json", 2    ' overwrite
    ostream.Close
End If
End Sub
 

JumboCactuar

Well-known Member
Joined
Nov 16, 2016
Messages
685
@Worf
Thanks for the reply but it isn't this simple as the site requires secure login.

I managed to automate this with IE, though stuck at the (Open /Save) notification bar that pops up.

Tried lots of code from various sites but no luck.
 

Watch MrExcel Video

Forum statistics

Threads
1,102,283
Messages
5,485,863
Members
407,522
Latest member
Tashbbb

This Week's Hot Topics

Top