Custom menu Item

R

Rick

I have a command button on a form that runs VB code in a Private sub. What
I'd like to do is set a menu item to do the same thing. I think this can be
done with the " On Action" control from the properties menu on the
"customize" menu, I'm just not sure how.

Rick
 
R

Rick Brandt

Rick said:
I have a command button on a form that runs VB code in a Private sub.
What I'd like to do is set a menu item to do the same thing. I think
this can be done with the " On Action" control from the properties
menu on the "customize" menu, I'm just not sure how.

Rick

Put your code in a function (not a sub) in a standard module and then use...

=FunctionName()

....in the menu item's OnAction property.
 
R

Rick Brandt

Rick said:
Okay Rick. You lost me. How do I set up a function?

In your VBA code instead of..

Sub SubName
(code)
End Sub

....use...

Function FunctionName
(code)
End Function
 
R

Rick

Thanks Rick. That's just what i needed.



Rick Brandt said:
In your VBA code instead of..

Sub SubName
(code)
End Sub

....use...

Function FunctionName
(code)
End Function
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top