Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Passing Params to Embedded query programmatically

Trying to create a loop that refreshes a query with a new parameter each
loop. I can figured out how to refresh the query by recording a macro, but
I do not see anything passing a parameter even though a popup form showed
allowing a parameter entry.

Any ideas
Thanx

Example:
Dim ParamRange as string
For i=1 to somenumber

ParamRange = "A" & i
parameter value = Range(ParamRange).value
Refresh query
copy and paste result to desired worksheet
Next


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,163
Default Passing Params to Embedded query programmatically

The result range of the query is a querytable object in VBA, and it has a
Parameters collection associated with it that can be used to set the
parameter values, so it would go something like this:

Dim ParamRange as string
For i=1 to somenumber

ParamRange = "A" & i
With Sheets("QueryTableSheetName").QueryTables("QueryTa bleName")
.Parameters("ParameterName").Value = Range(ParamRange).value
.Refresh
End With
copy and paste result to desired worksheet
Next

"G" wrote:

Trying to create a loop that refreshes a query with a new parameter each
loop. I can figured out how to refresh the query by recording a macro, but
I do not see anything passing a parameter even though a popup form showed
allowing a parameter entry.

Any ideas
Thanx

Example:
Dim ParamRange as string
For i=1 to somenumber

ParamRange = "A" & i
parameter value = Range(ParamRange).value
Refresh query
copy and paste result to desired worksheet
Next



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
Passing Dates criteria in MS Query Jim Thomlinson Excel Discussion (Misc queries) 1 April 1st 08 07:06 PM
Selecting Embedded charts in Active Sheets programmatically Barb Reinhardt Charts and Charting in Excel 5 January 15th 06 02:36 PM
programmatically open excel from asp with web query url loaded cindy Excel Programming 0 September 17th 04 12:29 AM
Passing SQL Query Result Into A Variable Elliot[_2_] Excel Programming 4 January 9th 04 09:55 AM
print embedded active chart programmatically tag Excel Programming 0 August 13th 03 05:15 PM


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