VBA - transfer data from a Website (with login)

Mark1112

New Member
Joined
Nov 21, 2021
Messages
4
Office Version
  1. 2019
Platform
  1. Windows
Hi guys !
I am trying to tranfer a single value from a Website to my Sheet in Excel.
Thanks to Google I have found how to open a link and write my user-id and password, this is the VBA:

VBA Code:
Sub Login()
Dim IE As SHDocVw.InternetExplorer
Dim iDoc As MSHTML.HTMLDocument
Set IE = New InternetExplorer

With IE
    .Visible = True
    .navigate ("https://investing.com/portfolio/")
    Do While .readyState <> READYSTATE_COMPLETE: DoEvents: Loop
End With

Set iDoc = IE.document

iDoc.all.loginFormUser_email.Value = "my_email"
iDoc.all.loginForm_password.Value = "my_password"

Do While IE.readyState <> READYSTATE_COMPLETE: DoEvents: Loop
   
Set IE = Nothing
Set iDoc = Nothing
    
End Sub

It works, it opens the website and writes my user id and pwd in the correct position.
But now, I don't know how to continue... I need to click on the "Sign In" button to proceed.
I have tryed inspecting the website but I don't understand how can I do.
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand

Forum statistics

Threads
1,215,758
Messages
6,126,709
Members
449,331
Latest member
smckenzie2016

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