Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Assign several macros with OnAction

Hi,

I have created some CommandBarButtons. I assign which macro to run when
selecting the menu item by using the OnAction property.
myMenyItem.onAction = "updateData"

I would like two run several macros instead of one, in fashion og
myMenyItem.onAction = "updateData1 : updateData2 : updateScreen"

where updateData1, updateData2, updateScreen are three different subs.
Is this possible?

Best Regards
Eric

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Assign several macros with OnAction


Try creating a wrapper sub which calls the three: e.g.

...
myMenyItem.onAction = "WrapperSub"
...

sub WrapperSub()
updateData1
updateData2
updateScreen
end sub


Co

--
colofnatur
-----------------------------------------------------------------------
colofnature's Profile: http://www.excelforum.com/member.php...fo&userid=3435
View this thread: http://www.excelforum.com/showthread.php?threadid=56278

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default Assign several macros with OnAction

You can one macro form another:
Sub updateData()
Call updateData1
Call updateData2
Call updateScreen
End sub



wrote in message
ups.com...
Hi,

I have created some CommandBarButtons. I assign which macro to run when
selecting the menu item by using the OnAction property.
myMenyItem.onAction = "updateData"

I would like two run several macros instead of one, in fashion og
myMenyItem.onAction = "updateData1 : updateData2 : updateScreen"

where updateData1, updateData2, updateScreen are three different subs.
Is this possible?

Best Regards
Eric



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Assign several macros with OnAction


NickHK wrote:
You can one macro form another:
Sub updateData()
Call updateData1
Call updateData2
Call updateScreen
End sub

[...]

Yes, I know I can do it like this, but since I have a lot of
permutations of how to run the macros (macro1 - macro3 - macro2,
macro3 - macro1, et.c) I would be happy if I did not have to clutter
the workbook with a lot of macros.

Like an if-then, you can write it on one row and separate expressions
with ":".

Best Regards
Eric

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default Assign several macros with OnAction

If it really matters to you to confuse the coding in order to save a few
lines:
Sub updateData()
updateData1: updateData2: updateScreen
End sub

NickHK

wrote in message
ups.com...

NickHK wrote:
You can one macro form another:
Sub updateData()
Call updateData1
Call updateData2
Call updateScreen
End sub

[...]

Yes, I know I can do it like this, but since I have a lot of
permutations of how to run the macros (macro1 - macro3 - macro2,
macro3 - macro1, et.c) I would be happy if I did not have to clutter
the workbook with a lot of macros.

Like an if-then, you can write it on one row and separate expressions
with ":".

Best Regards
Eric



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Assign different macros for True/False button Ken G. Excel Discussion (Misc queries) 2 April 3rd 09 04:50 AM
Assign Macros to a dropdown list JT Excel Programming 6 November 12th 04 12:43 AM
How to stop having to re-assign macros every time you open a workbook??? Simon Lloyd[_533_] Excel Programming 3 August 16th 04 03:27 AM
Assign macros to dynamically created form elements Joepy Excel Programming 4 March 3rd 04 09:03 PM


All times are GMT +1. The time now is 03:06 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"