There are a variety of way to get user input into a macro. The one I use most often is the dialog function, using the dialog editor from within the macro editor. An easy alternative is to use the InputBox function:
InputBox Syntax:
InputBox[$]( prompt$ , [title$] , [default$] ,[xpos% , ypos%] )
Forgetting the xpos, ypos, which just determine where on the screen the box shows up, you need to use the other arguments, as in this example:
sub main
Dim Month
Dim msgtext
msgtext="Enter a month number (1-12):"
Month =InputBox$(msgtext, "Month Selector",1)
MsgBox "The month you entered is: " & Month
end sub
Just take the relevant portion of the code and stick it into your macro, replacing the constant x with the variable Month.
Give this a try and come back if you have questions.
Regards,
Dave Griffin
The Decision Support Group
Reporting Consulting with Cognos BI Tools
"Magic with Data"
Want good answers? Read FAQ401-2487 first!