.OnAction - Multiple Calls

M

Matt

Hi

I am using .OnAction in floating menubar and I want to know can you have
the .OnAction call more then one subroutine?

Example
With Format
.Caption ="Fomat a Sheet"
.OnAction ="Format"
End With

I want to do something like below - that way since everything runs off this
menubar I can keep the code more compact by putting in calls to Unlock
and Lock before and after I do something to a sheet such as my format example
I have tried a few different ways and have been unsuccessfull

Example
With Format
.Caption ="Fomat a Sheet"
.OnAction ="UnlockSht" "Format" "LockSht"
End With
 
R

Rob Bovey

Hi Matt,

Those calls should go inside your Format procedure, not in the OnAction
property, e.g.:

Sub Format()
UnlockSht
''' The rest of your Format procedure code here.
LockSht
End Sub

--
Rob Bovey, MCSE, MCSD, Excel MVP
Application Professionals
http://www.appspro.com/

* Please post all replies to this newsgroup *
* I delete all unsolicited e-mail responses *
 
C

Chip Pearson

Matt,

OnAction can call only a single procedure. The work-around is to
call a procedure that calls the other three. E.g.,

Sub DoAllThree()
UnlockSht
Format
LockSht
End Sub

Assign DoAllThree to the menu item.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com (e-mail address removed)
 

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