Hi,
I have a macro defined on excel sheet1 (to save the sheet to a file) and want to
run this macro from a command button on sheet2. I have tried adding:
xlapp.Run "Sheet1!save"
in the vba for the button but the vb interpreter says there is no object.
Does anyone know if its possible to do this?
Thanks
Assuming the button is from the Forms Tool Box, right-click the command button and choose "Assign Macro" from the context menu. The dialog box should display the name of the macro in sheet1 (unless you have used "Private Sub" when creating the macro - in which case remove the word "Private", then assign the macro, then add "Private" back to the macro name.
Palmetto
Do you know . . . ?
You can leave feedback and add to the reputation of all who contributed a helpful response to your solution by clicking the star icon located at the left in one of their post in this thread.
If you know the name of the macro, even though it's a private sub you can manually type it into the Assign Macro window, as long as you type it accurately it will be accepted.
_________________
Microsoft MVP 2010 - Excel
Visit: Jerry Beaucaire's Excel Files & Macros
If you've been given good help, use theicon below to give reputation feedback, it is appreciated.
Always put your code between code tags. [CODE] your code here [/CODE]
“None of us is as good as all of us” - Ray Kroc
“Actually, I *am* a rocket scientist.” - JB (little ones count!)
Thanks Palmetto your suggestion worked perfectly
Glad to be of help.
Please mark your thread as solved by going to the top of YOUR first post and clicking on Thread Tools, then Go Advanced and choose the [SOLVED] prefix.
Palmetto
Do you know . . . ?
You can leave feedback and add to the reputation of all who contributed a helpful response to your solution by clicking the star icon located at the left in one of their post in this thread.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks