Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Passing Dates criteria in MS Query | Excel Discussion (Misc queries) | |||
Selecting Embedded charts in Active Sheets programmatically | Charts and Charting in Excel | |||
programmatically open excel from asp with web query url loaded | Excel Programming | |||
Passing SQL Query Result Into A Variable | Excel Programming | |||
print embedded active chart programmatically | Excel Programming |