Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Speed issue with Multilple Web Queries

A co-worker was working on a spreadsheet that is pulling sports team
data
Each schedule is on a different URL and as such he has to call the
function 30 times.
This is a slow process. Is there anyway to call multiple web queries
without having to initialize a new connection?

i've included the code in case there is something else in the code
that could be causing the slow-down.

thanks in advance


Function GetSchedule(Team As String) As Worksheet
Dim Dst As Worksheet
Dim DstRange As Range
Dim Name As String
Dim Connection As String

Set Dst = ActiveWorkbook.Worksheets.Add
Set DstRange = Dst.Range("A1")

'All Text
Dst.Cells.NumberFormat = "@"

Connection = "URL;http://www.nhl.com/nhl/app?
service=page&page=TeamSchedule" & _
"&team=" & Team & "&season=" & Season
Name = "app?service=page&page=TeamSchedule&team=" & Team &
"&season=" & Season

With Dst.QueryTables.Add(Connection:=Connection,
Destination:=DstRange)
.Name = Name
.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 = TablesToGrab
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = True
.WebDisableRedirections = False
.Refresh BackgroundQuery:=False
End With

Set GetSchedule = Dst
End Function

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default Speed issue with Multilple Web Queries

You have .Refresh BackgroundQuery:=False. So the code is synchronous; it
waits for the query to finish before continuing.
If you set if to True, the code will continue whilst the query is
connecting.
Of course, you have to allow for the fact that there may not be data
available yet when you come to read it.

NickHK

wrote in message
ups.com...
A co-worker was working on a spreadsheet that is pulling sports team
data
Each schedule is on a different URL and as such he has to call the
function 30 times.
This is a slow process. Is there anyway to call multiple web queries
without having to initialize a new connection?

i've included the code in case there is something else in the code
that could be causing the slow-down.

thanks in advance


Function GetSchedule(Team As String) As Worksheet
Dim Dst As Worksheet
Dim DstRange As Range
Dim Name As String
Dim Connection As String

Set Dst = ActiveWorkbook.Worksheets.Add
Set DstRange = Dst.Range("A1")

'All Text
Dst.Cells.NumberFormat = "@"

Connection = "URL;http://www.nhl.com/nhl/app?
service=page&page=TeamSchedule" & _
"&team=" & Team & "&season=" & Season
Name = "app?service=page&page=TeamSchedule&team=" & Team &
"&season=" & Season

With Dst.QueryTables.Add(Connection:=Connection,
Destination:=DstRange)
.Name = Name
.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 = TablesToGrab
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = True
.WebDisableRedirections = False
.Refresh BackgroundQuery:=False
End With

Set GetSchedule = Dst
End Function



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel 2007 compatibility issue - speed between cells Simon Whale[_2_] Excel Discussion (Misc queries) 2 November 11th 09 12:06 PM
Speed Issue Stephgill Excel Discussion (Misc queries) 0 October 9th 08 12:01 PM
Speed Issue after updating cells Simon Day Excel Discussion (Misc queries) 0 October 8th 08 03:10 PM
Calculation speed issue Steve M Excel Discussion (Misc queries) 4 January 14th 06 02:18 AM
Dynamic Ranges: Speed Issue Sige Excel Worksheet Functions 5 December 12th 05 09:28 PM


All times are GMT +1. The time now is 04:09 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"