Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default Modify Web Query using macros?

Greetings,

Is it possible to modify a Web Query command string by using a macro?
I need to execute one of 500 queries that are ALL similar with the exeption
of one number changing from the string (such as WebPage001List,
WebPage002List... WebPage500List.
Is there a way to access the query strings via Excel or VB?.

Thank you in advance for your support.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 599
Default Modify Web Query using macros?

Spyren

Yes, you can change the Connection property of the QueryTable object. The
Connection property for a web query looks like this

URL;http://www.mysite.com/WebPage001List.htm

It's a string, so you can manipulate it like you do any other string, then
Refresh the QueryTable.

Dim sNew As String

sNew = "WebPage033List.htm"

With Sheet1.QueryTables(1)
.Connection = Replace(.Connection, "WebPage001.htm", sNew)
.Refresh False
End With


--
Dick Kusleika
MVP - Excel
Excel Blog - Daily Dose of Excel
www.dicks-blog.com

"SPYREN" wrote in message
...
Greetings,

Is it possible to modify a Web Query command string by using a macro?
I need to execute one of 500 queries that are ALL similar with the

exeption
of one number changing from the string (such as WebPage001List,
WebPage002List... WebPage500List.
Is there a way to access the query strings via Excel or VB?.

Thank you in advance for your support.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default Modify Web Query using macros?

Thank you for your input. I will try it imediately.



"Dick Kusleika" wrote:

Spyren

Yes, you can change the Connection property of the QueryTable object. The
Connection property for a web query looks like this

URL;http://www.mysite.com/WebPage001List.htm

It's a string, so you can manipulate it like you do any other string, then
Refresh the QueryTable.

Dim sNew As String

sNew = "WebPage033List.htm"

With Sheet1.QueryTables(1)
.Connection = Replace(.Connection, "WebPage001.htm", sNew)
.Refresh False
End With


--
Dick Kusleika
MVP - Excel
Excel Blog - Daily Dose of Excel
www.dicks-blog.com

"SPYREN" wrote in message
...
Greetings,

Is it possible to modify a Web Query command string by using a macro?
I need to execute one of 500 queries that are ALL similar with the

exeption
of one number changing from the string (such as WebPage001List,
WebPage002List... WebPage500List.
Is there a way to access the query strings via Excel or VB?.

Thank you in advance for your support.




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
Help to modify the query? Eric Excel Worksheet Functions 0 March 11th 08 05:54 AM
Another query about hiding columns with Macros Jim@Tech Excel Discussion (Misc queries) 6 October 4th 07 01:42 PM
Strip workbook of macros, VBA, MS Query, etc. Paul Kraemer Excel Discussion (Misc queries) 4 September 7th 06 01:30 PM
Forcing MS Query to run before macros Dkline[_2_] Excel Programming 1 August 11th 04 05:08 PM
Exporting macros to a different users PC query paul Excel Programming 1 December 1st 03 03:38 PM


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