LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Multiple Web Queries

Hi - I am trying to get addresses for all NHS Trusts (UK Healthcare
organisatins) using web queries.

Thus I have built a loop which changes the url for each iteration.

While is kind of works... the problem is:

a) I get a load of other junk back I don't need
b) Unless I specify a really high row value (using jj) each on each
itteration, the output seems to be shifted along a number of columns

Anyone have any views as to what I can do to make this work a little better.

Examples of the urls a

http://www.nhs.uk/root/localnhsservi...ite.asp?id=RTV
http://www.nhs.uk/root/localnhsservi...ite.asp?id=RGT
http://www.nhs.uk/root/localnhsservi...ite.asp?id=REM


The last 2 chars change for each trust of which there are 264

I have the following code:

Sub test1()

Dim hVar, tName As String
Dim ii, jj As Integer

jj = 2

For ii = 2 To 5 /*
testing - this will become about 300 */

hVar = Sheets("nhs_List").Range("C" & ii) /* takes url from a
worksheet cell */
tName = Sheets("nhs_List").Range("A" & ii) /* Takes trust name from a
worksheet cell */

Range("E" & jj).Value = tName /* puts name in cell
e2, e82, e162... etc

With ActiveSheet.QueryTables.Add(Connection:= _ /* web query which
parses hvar and gets data from each web location*/
"URL;" & Trim(hVar), _
Destination:=Sheets("nhs_list").Range("E" & jj))
.Name = "5 Boroughs Partnership NHS Trust"
.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

'range("E2").Select /* test code...
*/
'ActiveCell.SpecialCells(xlLastCell).Select
'Range("R300").Select

jj = jj + 80 /* increment
row where next query will be put by 80 */

Next
End Sub


 
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
queries with multiple criteria Sandre Excel Discussion (Misc queries) 3 June 19th 09 02:03 AM
Multiple queries under same connection CLamar Excel Discussion (Misc queries) 0 June 20th 06 02:31 PM
Multiple worksheet queries liam Excel Worksheet Functions 3 February 16th 05 06:52 PM
Excel Queries Against Multiple Databases Robert Minneman Excel Programming 2 October 6th 03 04:40 PM
Multiple queries using *.dqy files Bart E Excel Programming 0 August 29th 03 11:45 AM


All times are GMT +1. The time now is 05:42 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"