By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,148 Members | 765 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,148 IT Pros & Developers. It's quick & easy.

Can a command button be coded to prompt a user between two different subroutines

USTRAGNU1
P: 36
Hello,

I have two subroutines. One creates/delivers a one worksheet excel workbook, the other one creates/delivers a multiple worksheet excel workbook.

Can the code behind a single command button be modified to prompt a user to choose between two different subroutines? Sort of like the principle of a parameter query?

I have looked online but not quite found anything.

Thank you.

UTS
Aug 23 '18 #1
Share this Question
Share on Google+
11 Replies


Rabbit
Expert Mod 10K+
P: 12,366
Yes, create a third sub that asks the user which one they want and use if then else to call the correct one depending on their response.
Aug 23 '18 #2

USTRAGNU1
P: 36
Touchdown, thanks! Or should I say GGGGGGOOOOOAAAAAALLLLLL!

UTS
Aug 23 '18 #3

NeoPa
Expert Mod 15k+
P: 31,494
Yes. You can use MsgBox() in your Command Button Event Procedure to determine what the operator requires then invoke either of the other routines depending on their response.
Aug 23 '18 #4

USTRAGNU1
P: 36
Excellent. Mille Grazie!

UTS
Aug 23 '18 #5

NeoPa
Expert Mod 15k+
P: 31,494
USTRAGNU1:
Or should I say GGGGGGOOOOOAAAAAALLLLLL!
Rabbit claims to be from California so not sure he's more likely to be into (Association) Football rather than American Football.

I think it sounds good though. I'm from London England where Football is certainly the dominant sport - even though we're seeing more from the NFL here as the years go by.
Aug 23 '18 #6

zmbd
Expert Mod 5K+
P: 5,397
Personally,
I would have the user chose the option via an option group, combobox, or list box and have the button's on_click event determine which procedure to call based on that selection. It feels more intuitive and the user has an idea of what is going to happen "up-front" when the code is executed.
Aug 23 '18 #7

USTRAGNU1
P: 36
OIC that is a nice option as well. Thank you.
UTS
Aug 23 '18 #8

USTRAGNU1
P: 36
I thought everyone was from England. Sorry about that! I was watching a documentary on Hampton Court palace last night. Absolutely amazing structure/history. I watched it twice!
Aug 23 '18 #9

USTRAGNU1
P: 36
In fact, and expert from another site ended his email with "Cheers", so I looked up British terms and peppered my reply with them for humorous effect.

He replied by telling me he is from California, he just likes using Cheers as a salutation. Yikes.
Aug 23 '18 #10

twinnyfo
Expert Mod 2.5K+
P: 3,284
Remember - Air Force Pilots like the term "Cheers" too!
Aug 23 '18 #11

NeoPa
Expert Mod 15k+
P: 31,494
USTRAGNU1:
He replied by telling me he is from California, he just likes using Cheers as a salutation. Yikes.
Well, the whole West Coast of America, and particularly the North-West, is getting very into their craft beers now. This could be why that term's getting popular.

Not everyone in England even is still into real ale, but many of us still are - particularly the most discerning of us ;-)
Aug 23 '18 #12

Post your reply

Sign in to post your reply or Sign up for a free account.