ie.Navigate save file to folder?

JumboCactuar

Well-known Member
Joined
Nov 16, 2016
Messages
677
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

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).

Worf

Well-known Member
Joined
Oct 30, 2011
Messages
3,938
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
677
@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,095,724
Messages
5,446,149
Members
405,384
Latest member
geowbadyt

This Week's Hot Topics

Top