I need to download CSV file from the below site. When I visit a page, I need to choose drop down option from "View Options Contracts for" and "Expiry Date", then on right side, I get to see CSV file, which is embedded. I used below code, I am unable to download file. Any assistance will be much appreciated.
https://www.nseindia.com/option-chain
Option Explicit
Public Sub testing()
Dim qt As QueryTable
Dim ws As Worksheet
Set ws = ThisWorkbook.Worksheets("Test")
Const URL As String = "https://www.nseindia.com/option-chain"
Set qt = ws.QueryTables.Add(Connection:="URL;" & URL, Destination:=ws.Range("A1"))
With qt
.RefreshOnFileOpen = True
.FieldNames = True
.WebSelectionType = xlSpecifiedTables
.WebTables = 1
.Refresh BackgroundQuery:=False
End With
End Sub