VBA get data from a web page

j4ymf

Well-known Member
Joined
Apr 28, 2003
Messages
743
Office Version
  1. 365
Platform
  1. Windows
Sub Get_webpage()

Rows("6:251").Select
Selection.Delete Shift:=xlUp

'Copy web page to sheet1
On Error GoTo error
Application.ScreenUpdating = False

Set ie = CreateObject("InternetExplorer.Application")
With ie
.Visible = True
.Navigate "https://xxxx.boris-software.com/Auth/App.aspx?list=GeneralWork&mitId=1013&"""
Do Until .ReadyState = 4
DoEvents
Loop
.document.all.Item("Login1_UserName").Value = "xxx"
.document.all.Item("Login1_Password").Value = "xxx"
.document.forms(0).submit
End With


With Sheets("Sheet1").QueryTables.Add(Connection:= _
"URL;https://xxxx.boris-software.com/Auth/App.aspx?list=GeneralWork&mitId=1013&", _
Destination:=Sheets("Sheet1").Range("A10"))

.BackgroundQuery = True
.TablesOnlyFromHTML = True
.Refresh BackgroundQuery:=False
.SaveData = True
End With

error:
Application.ScreenUpdating = True

Range("B5").Select


End Sub
Hello All

im looking to get the data from a password protected web site, i know the user name and password but i still can't get it to work
it downloading the password page so its conecting to the website.

ive looked up the source page and found the username tag and im sure thats correct, any ideas why it won't get pass the password?

Thank you
 

Attachments

  • Screenshot 2021-12-21 203542.jpg
    Screenshot 2021-12-21 203542.jpg
    29.9 KB · Views: 35

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
It doesn’t work like that, the cookie you’d get from Internet Explorer for successful login won’t be passed to the query connection, it’s therefore not authenticated when you log in.

I think you’d need to automate the process using IE for the whole thing
 
Upvote 0
It doesn’t work like that, the cookie you’d get from Internet Explorer for successful login won’t be passed to the query connection, it’s therefore not authenticated when you log in.

I think you’d need to automate the process using IE for the whole thing
Hi Kyle

Thank you
Could you point me in the right direction please so I can read what to do
 
Upvote 0
I don't really have anything to point you to. Essentially, once it's logged in, you then find the data you want to download in the same way you figured out the control names for logging in.
 
Upvote 0

Forum statistics

Threads
1,223,243
Messages
6,170,964
Members
452,371
Latest member
Frana

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