Home |
Search |
Today's Posts |
|
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Command line parameters into a macro
Hi,
Is there any way I can pass some parameters into a macro? The macro is currently executing correctly except that I am hard coding a variable that I want passed into it. Ideally I'd like to pass it in from a hyperlink - something like "myspreadsheet.xls?paramvalue=12345". Does anyone know if this is possible? Regards, Tony |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Command line parameters into a macro
Hi Tony,
Take a look at Chip Pearson's page at the differences between Macros and Functions: Macros And Functions (Differences) http://www.cpearson.com/excel/differen.htm I will assume you have the distinction correct because you said you had to hard code the values into the macro, and the purpose of a function is generally to use parameters. But please read the above anyway. It will answer at least one part of question that you asked.. You can use an inputbox in a macro to obtain values see Prefix160 and other macros using InputBox in http://www.mvps.org/dmcritchie/excel/join.htm http://www.mvps.org/dmcritchie/excel/code/join.htm Syntax InputBox(prompt[, title] [, default] [, xpos] [, ypos] [, helpfile, context]) example with prompt, title, and default value:: Dim nRowsX as String nRowsX = InputBox("Specify number of rows (including Cell A1)," _ & Chr(10) & "number of columns will be same as number of rows)" _ & " suggesting " & nRows, _ "Selection of Number of rows to Rotate", nRows) If nRowsX = "" Then GoTo done 'Check for cancellation You can have a short macro call another macro using parameters, but you cannot invoke a macro and pass it parameters. Example XL2HTML, XL2HTMLs, XL2HTMLx, XL2HTMLa all call XL2HTML_MAIN in http://www.mvps.org/dmcritchie/excel/code/xl2htmlx.txt When you use a real ISP as your return address, anyone who tries to reply to you will send a response essentially to the server administrator, who will either have to figure out who it is for or in the case of Microsoft simply reject it. --- HTH, David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001] My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm Search Page: http://www.mvps.org/dmcritchie/excel/search.htm "Donemowe" wrote in message ... Hi, Is there any way I can pass some parameters into a macro? The macro is currently executing correctly except that I am hard coding a variable that I want passed into it. Ideally I'd like to pass it in from a hyperlink - something like "myspreadsheet.xls?paramvalue=12345". Does anyone know if this is possible? Regards, Tony |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Command line parameters into a macro
Let me try to rephrase my statement:
You can have a short macro call another macro using parameters, but you cannot invoke a macro and pass it parameters. You can have a short macro call another macro using parameters from your code. You cannot invoke a macro from the worksheet. |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Command line parameters into a macro
Thanks everyone - I'm going to give these a go.
Many thanks, Tony "David McRitchie" wrote in message ... Let me try to rephrase my statement: You can have a short macro call another macro using parameters, but you cannot invoke a macro and pass it parameters. You can have a short macro call another macro using parameters from your code. You cannot invoke a macro from the worksheet. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Are there command line parameters for Excel? | Excel Discussion (Misc queries) | |||
Run Macro from Command line | Excel Discussion (Misc queries) | |||
Command Line Export | Excel Discussion (Misc queries) | |||
Q: command line in OE | Excel Discussion (Misc queries) | |||
Excel macro on a DOS command line | Excel Programming |