Passing value from menu item into macro
Maybe someone has done this, I cannot figure it out.
I have a custom menu that is created from a table in a worksheet. This is done and works.
The menu is essentially a list, and I want it to run the same code no matter what item is clicked. The difference is that the item name (or the caption if you will) is passed into the sub.
The subname would be "MapPlanting(Crop as string)".
Crop would be one of the 20 potential items, and the sub could take over from there and find the criteria associated with the selection.
I cannot get it to pass in the variable. When the menu is built I tried the following:
PositionOrMacro = "MapPlanting(" & Chr(34) & MenuArray(3, y) & Chr(34) & ")"
But this yields the error message:
"The macro 'MapPlanting("Cab") cannot be found."
Anyone know how to do this??
|