How does a macro receive a function argument?
I
How does a macro receive a function argument?
I

This month, every Windows Secrets subscriber can download a one-chapter excerpt of Windows 7: The Missing Manual.Windows 7: The Missing Manual provides valuable information to help you overcome these difficulties in learning a new operating system. Subscribe today to download your free excerpt.
If you select RunCode as action, the first row in Action arguments will be labeled Function name (it might be slightly different in English).
Enter the function just as you would in code, or in an expression (but without = in front of the function name). For instance if you want to execute the function MyFunc with string argument "Jones":
MyFunc("Jones")
Yes, I understand your point, but what if the argument is not the same every time the function is called? This is what I want to do. If I specify the VALUE of the argument in the macro what good is that to me when that single value could be one of several? Hope you see my point.
(1) you can replace the literal string "Jones" by a reference to a control on a form, or by an expression:
MyFunc(Forms!frmMyForm!txtLastName)
(2) If you want to do more complicated things, convert the macro to VBA. In VBA, you can refer to variables and constants.
Well point 2 is what I want & I guess what you
You're right. VBA is much more flexible than macros.
If you have a macro already, you can convert it:
Select the macro in the database window.
Select Save As/Export... from the File menu.
Select the option to convert to Visual Basic.
You can include error handling and a description as options.