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: 347
Default Query Tables naming not going to plan...

Hi everyone, I'm using Query Tables to grab some data from our corporate
intranet and it's all working very well apart from one minor problem...each
query gets "_x" added to the name, where x is a number (starting at one).

The code for the QueryTable is as follows...essentially I have code before
this to check if we already have a Query open on the sheet and it refreshes
it rather than creating a new one...

Set qt = ws.QueryTables.Add(connection, ws.Range("A1"))
With qt
.name = "PD" & tabName & "WebQuery"
.FieldNames = True
.PreserveFormatting = False
.RefreshStyle = xlOverwriteCells
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.WebSelectionType = xlEntirePage
.WebFormatting = xlWebFormattingNone
.Refresh BackgroundQuery:=True
End With

"tabName" is just something to keep a track of which sheet we are
on...values can be anything you want (think countries).

When I create a QueryTable on each sheet in this way I get (for example):

PDEnglandWebQuery_1
PDAmericaWebQuery_1
....and so on

My refresh criteria is looking for the name set in the qt
("PDEnglandWebQuery") but obviously doesn't find it because of the _1.

Any suggestions on what I'm doing wrong?

Thanks
George
 
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
QueryTable.add naming problem (web query) PeacefulAnd4getful Excel Programming 2 August 27th 10 08:30 AM
Data Tables and Cell Naming anonymous Excel Discussion (Misc queries) 1 April 10th 07 09:18 AM
Naming word tables or coding reference library with vba hornbecky83 Charts and Charting in Excel 6 January 21st 07 01:11 AM
Naming word tables or coding reference library with vba hornbecky83 Excel Programming 4 January 21st 07 01:11 AM
format plan into tables Little pete Excel Discussion (Misc queries) 3 June 2nd 06 05:14 PM


All times are GMT +1. The time now is 03:01 AM.

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

About Us

"It's about Microsoft Excel"