View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Dick Kusleika[_3_] Dick Kusleika[_3_] is offline
external usenet poster
 
Posts: 599
Default Parameter Query executed from a Macro

David

It sounds like you already have a query in a worksheet. Is it a parameter
query? If so, you only need to refresh it to get a prompt with code like

Sheet1.QueryTables(1).Refresh

If it's not a parameter query, you can either make it one, or prompt the
user for a value using InputBox and adjust the SQL to reflect that new
value. See here

http://www.dicks-clicks.com/excel/Ex....htm#ChangeSQL

and here

http://www.dicks-clicks.com/excel/Ex...htm#Parameters

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

"David" wrote in message
...
Hi,

I am trying to get a Macro, to execute a parameter query, that will prompt

a user to enter a variable. Every time that I try to record my macro, my
session abends. My query works perfectly, when i execute it independent of
my macro.

Can I do this in Excel.

I know this is easy in Access.

Thank You very much