Hello,
How determine .html file size < 150kb not proceed query vb code ?
Sub Macro1()
Set sh1 = Sheets("Sheet1")
Set sh2 = Sheets("Sheet2")
With sh1.QueryTables.Add(Connection:="URL;http://www.nfl.com", Destination:=sh1.Range("A1"))
.Name = False ''''''''''''' IF http://www.nfl.com html file size = 175KB >150KB query data '''''''''''''''
.FieldNames = False
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = False
.RefreshOnFileOpen = False
.BackgroundQuery = False
.RefreshStyle = xlOverwriteCells
.SavePassword = False
.SaveData = False
.AdjustColumnWidth = False
.RefreshPeriod = 0
.WebSelectionType = xlEntirePage
.WebFormatting = xlWebFormattingNone
.WebPreFormattedTextToColumns = False
.WebConsecutiveDelimitersAsOne = False
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = False
.Refresh BackgroundQuery:=False
End With
With sh2.QueryTables.Add(Connection:="URL;http://www.nba.com", Destination:=sh2.Range("A1"))
.Name = False ''''''''''''' IF http://www.nba.com html file size = 123KB <150KB ***NOT query data *** '''''''''
.FieldNames = False
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = False
.RefreshOnFileOpen = False
.BackgroundQuery = False
.RefreshStyle = xlOverwriteCells
.SavePassword = False
.SaveData = False
.AdjustColumnWidth = False
.RefreshPeriod = 0
.WebSelectionType = xlEntirePage
.WebFormatting = xlWebFormattingNone
.WebPreFormattedTextToColumns = False
.WebConsecutiveDelimitersAsOne = False
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = False
.Refresh BackgroundQuery:=False
End With
End Sub
Bookmarks