ie.Navigate save file to folder?

JumboCactuar

Well-known Member
Joined
Nov 16, 2016
Messages
785
Office Version
  1. 365
Platform
  1. Windows
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?
 

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
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
 
Upvote 0
@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.
 
Upvote 0

Forum statistics

Threads
1,213,489
Messages
6,113,954
Members
448,535
Latest member
alrossman

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top