Set ie1 = CreateObject("InternetExplorer.Application") ie1.Visible = True ie1.Navigate2 "http://www.micex.ru/marketdata/quotes" While ie1.ReadyState < READYSTATE_COMPLETE Application.Wait (Now + TimeValue("00:00:01")) Wend While ie1.Busy = True Application.Wait (Now + TimeValue("00:00:01")) Wend While Len(ie1.Document.getElementById("instrument-table").InnerHTML) < 500 Application.Wait (Now + TimeValue("00:00:01")) Wend i = 1 f = FreeFile Open "c:\1." + Str$(i) + ".txt.html" For Output As #f Print #f, ie1.Document.getElementById("instrument-table").OuterHTML Close #f While Not ie1.Document.getElementById("instrument-pager-next").className = "disabled" ie1.Document.getElementById("instrument-pager-next").Click While ie1.ReadyState < READYSTATE_COMPLETE Application.Wait (Now + TimeValue("00:00:01")) Wend While ie1.Busy = True Application.Wait (Now + TimeValue("00:00:01")) Wend While Len(ie1.Document.getElementById("instrument-table").InnerHTML) < 500 Application.Wait (Now + TimeValue("00:00:01")) Wend i = i + 1 f = FreeFile Open "c:\1." + Str$(i) + ".txt.html" For Output As #f Print #f, ie1.Document.getElementById("instrument-table").OuterHTML Close #f Wend ie1.Quit For j = 1 To i With ActiveSheet.QueryTables.Add(Connection:= _ "FINDER;file:///C:/1." + Str$(j) + ".txt.html", Destination:=Cells(11 * (j - 1) + 1, 1)) .Name = "1." + Str$(i) + ".txt" .FieldNames = True .RowNumbers = False .FillAdjacentFormulas = False .PreserveFormatting = True .RefreshOnFileOpen = False .BackgroundQuery = True .RefreshStyle = xlInsertDeleteCells .SavePassword = False .SaveData = True .AdjustColumnWidth = True .RefreshPeriod = 0 .WebSelectionType = xlEntirePage .WebFormatting = xlWebFormattingNone .WebPreFormattedTextToColumns = True .WebConsecutiveDelimitersAsOne = True .WebSingleBlockTextImport = False .WebDisableDateRecognition = False .WebDisableRedirections = False .Refresh BackgroundQuery:=False End With Next |