basil3legs
Programmer
I am running a VBA function that repeatedly opens webpages and then extracts data from them. I have a seperate sheet setup for the webpages to load into but every so often they open on another random sheet writing over it's contents. The code I am using to open the pages is:
Am I actually doing anything wrong or is Excel just getting it wrong every so often?
Code:
Sheets("Webpages").Select
Range("A1").Select
With Selection.QueryTable
.Connection = "URL;[URL unfurl="true"]http://www.*******.com/page.asp?ssss="[/URL] & Worksheets("AnotherPage").Cells(UrlLine, 1).Value
.WebSelectionType = xlEntirePage
.WebFormatting = xlWebFormattingAll
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = True
.Refresh BackgroundQuery:=False
End With
Am I actually doing anything wrong or is Excel just getting it wrong every so often?