Excel web query to login into a website

0 votes

There are two different passwords on the page, thus I'm seeking for a macro or vba code to log me in. I've got some code that uses Internet Explorer to access websites, but it doesn't retrieve data because the web query browser is not logged in and I'm only logged into Internet Explorer, not the excel web query browser. As a result, I can't use my previously created web query connections to refresh or update data in Excel.

Sub WebLogin()
Dim a As String
Set IE = CreateObject("InternetExplorer.Application")
With IE
    .Visible = True
    .Navigate "https://newtrade.sharekhan.com/rmmweb/login/LoginPage.jsp"
    Do Until .ReadyState = 4
        DoEvents
    Loop
    .Document.all.Item("loginid").Value = "myuserid"
    .Document.all.Item("brpwd").Value = "password1"
    .Document.all.Item("trpwd").Value = "password2"
    .Document.forms(0).submit
End With
IE.Quit
End Sub

Is there a way to update this code so that it uses the Excel Web Query Browser instead of Internet Explorer and can auto-log in with only a simple refresh of the external web connection that is already attached to my Excel sheet?

Sep 20 in Others by Kithuzzz
• 12,240 points
19 views

1 answer to this question.

0 votes
To be recognized by the web server in subsequent requests, you must obtain the cookie after signing in. Always login first in order to get that variable from the browser.

Grab the necessary cookies once you log in using the code you posted (try simulating your attempt in Internet Explorer using Network Recorder in the developer tools of the browser). After exiting IE, you can send those cookies to the server in the HTTP Post request.
answered Sep 21 by narikkadan
• 20,880 points

Related Questions In Others

0 votes
1 answer

How to import data from a HTML table on a website to excel?

Hello  To import any HTML file in excel there ...READ MORE

answered Feb 10 in Others by gaurav
• 18,960 points
117 views
0 votes
0 answers

how to list the contents of a asset into an event

May 29, 2019 in Others by anonymous
210 views
0 votes
1 answer
0 votes
0 answers

Write a DAX query to obtain the bottom 5 customers based on the order price

Jan 22, 2020 in Others by anonymous
• 160 points
167 views
0 votes
1 answer

Retrieve epay.info Balance with VBA and Excel

This code should log you in, provided ...READ MORE

answered Sep 5, 2018 in Blockchain by digger
• 26,720 points
402 views
0 votes
1 answer

How to load file to Excel Power query from SFTP site

Currently, I don't think there is a ...READ MORE

answered Dec 3, 2018 in Power BI by Upasana
• 8,620 points
2,095 views
0 votes
1 answer

Using VBA Excel to create a gramatically correct list

The Excel AND function is a logical ...READ MORE

answered Feb 9 in Others by gaurav
• 18,960 points
41 views
0 votes
2 answers

How to copy a formula horizontally within a table using Excel VBA?

Hi so basically, create an adjacent column ...READ MORE

answered Feb 16 in Others by Edureka
• 13,640 points
134 views
0 votes
1 answer

How to get the JasperReports into Excel format with proper alignment

Remove at least one parameter: exporter.setParameter(JRXlsExporterParameter.IS_COLLAPSE_ROW_SPAN,Boolean.TRUE) Note that JRXlsExportParameter is deprecated the correct ...READ MORE

answered Sep 21 in Others by narikkadan
• 20,880 points
26 views
0 votes
1 answer

Send message using excel to whatsapp web reloading

Inputs Range("W_C") = A list of Contacts' telephone ...READ MORE

answered Sep 21 in Others by narikkadan
• 20,880 points
44 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP