The website I am using is www.msci.com. The website makes use of several forms which can be altered. Each combination of choices creates a certain matrix of values (the desired data). I want to create the same variables in my excel sheet, such that I just have to fill in some codes in my sheet its column B to create a data table, which should be placed somewhere else in the same sheet.
I think I have to incorporate some html code in my macro to fill in these scroll down menus (forms). I discovered each of the choices underlying a form their html ID, and tried to incorporate those in my code. I think the code partly works, however changing the date from the calendar template surely is not working. My code so far :
Sub getMSCIdata()
Dim mktval As String
Dim curr As String
Dim indlvl As String
Dim calendarinput As String
curr = Range("$B$3")
mktval = Range("$B$2")
indlvl = Range("$B$4")
calendarinput = Range("$B$5")
With ActiveSheet.QueryTables.Add(Connection:= _
"URL;http://www.mscibarra.com/webapp/indexperf/pages/IEIPerformanceRegional.jsf?scope=0&mktval&size=36&style=C&calendarinput&curr&indlvl&lang=en" _
, Destination:=Range("$A$10"))
.Name = _
"IEIPerformanceRegional.jsf?scope=0&mktval&size=36&style=C&calendarinput&curr&indlvl&lang=en"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.WebSelectionType = xlSpecifiedTables
.WebFormatting = xlWebFormattingNone
.WebTables = """templateForm:tableResult0"""
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = True
.WebDisableRedirections = False
.Refresh BackgroundQuery:=False
End With
End Sub