import data from multiple pages of a website into a single excel sheet
import data from multiple pages of a website into a single excel sheet
Your intention isn't related to Excel in the sense that Excel is only the final recipient of the data which are to be obtained by scraping websites. I suggest you ask your question on a forum where they discuss scraping techniques.
This is probably the kind of thing that you need:
Sub ExcelWebsiteLogin()
'TeachExcel.com macro to login to a website.
Dim ie As Object
Dim frm As Variant
Dim element As Variant
'Requires Microsoft Internet Controls to be activated. Tools > References > Microsoft Internet Controls
Set ie = New InternetExplorerMedium
'website page where the login form is located
ie.navigate "https://www.teachexcel.com/"
While ie.readyState <> 4: DoEvents: Wend
'ID of the login form
Set frm = ie.document.getElementById("login_form")
'Name of the form, if there is no ID for it.
If frm Is Nothing Then Set frm = ie.document.getElementsByName("login_form").Item(0)
If frm Is Nothing Then
'Form not found.
'Error message if the form was not found
MsgBox "Login form not found."
'Kill the internet explorer instance
ie.Quit
Set ie = Nothing
Else
'Form found, proceed to fill it out and then submit it.
'Display the browser
ie.Visible = True
'Go through elements in the browser
For Each element In frm.elements
On Error Resume Next
'Input values into the form fields in the browser
Select Case element.Name
'username
Case "email": element.Value = "email@gmail.com"
'password
Case "password": element.Value = "password"
End Select
Next
'submit the form
frm.submit
End If
End Sub
This is one of our macros and it is explained here: Web Query Login Macro
Though the macro is for logging into a website, the techniques and concepts that are illustrated in it are directly applicable to what you are doing and should give you a major head-start on your project.