.OnAction - Multiple Calls

  • Thread starter Thread starter Matt
  • Start date Start date
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
 
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 *
 
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)
 
Back
Top