jonathanwang003
Board Regular
- Joined
- May 9, 2014
- Messages
- 133
Hi there,
I had a macro that worked before but fails now because the Query Editor says that it's using Internet Explorer Compatibility Mode.
I would prefer not having it download as a query table. In the old versions of excel, it was not as complicated as it is now. Any help would be super.
I recorded the macro below:
I had a macro that worked before but fails now because the Query Editor says that it's using Internet Explorer Compatibility Mode.
I would prefer not having it download as a query table. In the old versions of excel, it was not as complicated as it is now. Any help would be super.
I recorded the macro below:
Code:
ActiveWorkbook.Queries.Add Name:="Table 0", Formula:= _
"let" & Chr(13) & "" & Chr(10) & " Source = Web.Page(Web.Contents(""https://www.marketwatch.com/investing/stock/NVDA/options?countrycode=US&showAll=True""))," & Chr(13) & "" & Chr(10) & " Data0 = Source{0}[Data]," & Chr(13) & "" & Chr(10) & " #""Changed Type"" = Table.TransformColumnTypes(Data0,{{""Column1"", type text}, {""Column2"", type text}, {""Column3"", type text}, {""Column4"", type text}, {""Column5"", type text}, {""Column6"", type text}, {""Column7"", type text}, {""Column8"", type text}, {""Column9"", type text}, {""Column10"", type text}, {""Column11"", type text}, {""Column12"", type text}, {""Column13"", type text}, {""Column14"", type text}, {""Column15"", type text}})" & Chr(13) & "" & Chr(10) & "in" & Chr(13) & "" & Chr(10) & " #""Changed Type"""
With ActiveSheet.ListObjects.Add(SourceType:=0, Source:= _
"OLEDB;Provider=Microsoft.Mashup.OleDb.1;Data Source=$Workbook$;Location=""Table 0"";Extended Properties=""""" _
, Destination:=Range("$A$1")).QueryTable
.CommandType = xlCmdSql
.CommandText = Array("SELECT * FROM [Table 0]")
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.PreserveColumnInfo = True
.ListObject.DisplayName = "Options_Download"
.Refresh BackgroundQuery:=False
End With