Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 134
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 134
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default 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
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
Are there command line parameters for Excel? Michael Excel Discussion (Misc queries) 9 August 5th 07 06:29 PM
Run Macro from Command line Phil Smith Excel Discussion (Misc queries) 1 July 21st 07 06:35 PM
Command Line Export fjurek Excel Discussion (Misc queries) 6 April 23rd 07 09:08 PM
Q: command line in OE JIM.H. Excel Discussion (Misc queries) 0 May 30th 05 10:48 PM
Excel macro on a DOS command line Richard[_13_] Excel Programming 3 July 18th 03 03:35 AM


All times are GMT +1. The time now is 02:41 AM.

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"