Using VBA to submit form and download data

adhwn

New Member
Joined
Nov 27, 2017
Messages
8
Hi all,

My objective is to automate the download the current futures data from the website www.nseindia.com. For this, I tried using the following code:

Sub Test1()


Dim IE As Object
Set IE = CreateObject("InternetExplorer.Application")


IE.Visible = True
IE.Navigate "http://www.nseindia.com/products/content/derivatives/equities/historical_fo.htm"


Do While IE.Busy


Application.Wait DateAdd("s", 1, Now)


Loop


Set doc = IE.document


doc.GetElementById("instrumentType").Value = Range("A2")


doc.GetElementById("symbol").Value = Range("B2")
'doc.GetElementById("year").Value = Range("C2")
'doc.GetElementById("expiryDate").Value = Range("D2")


'doc.GetElementById("rdDateToDate").******* = "makeReadonly()"


'doc.GetElementById("fromDate").Value = Range("E2")
'doc.GetElementById("toDate").Value = Range("F2")






'doc.GetElementById("getButton").Click






End Sub

A2 = FUTIDX
B2 = NIFTY
C2 = 2000
D2 = 29-06-2000
E2 = 12-06-2000
F2 = 29-06-2000


After selecting the first drop, down nothing else works. My research led me to understand that this cannot be done using IE. Accordingly, I tried installing a Selenium wrapper and then tried with the following code:

Sub ChromeAutomation()
Chrome.Start: Chrome.Get "https://www.google.it/"
End Sub

However, excel throws up an error at .start.

The volume of data to be downloaded does not lend itself to manual work and thus I'd be grateful for any solutions to achieve the desired objective. Many thanks in advance.
 
I fully agree..with the selenium wrapper I am not even able to go past ".start".

Not particularly sure as to what can I do to resolve this..
 
Upvote 0

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December

Forum statistics

Threads
1,224,827
Messages
6,181,198
Members
453,022
Latest member
RobertV1609

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