PC Review


Reply
Thread Tools Rate Thread

Answer Message Box - Other than Y/N?

 
 
jday
Guest
Posts: n/a
 
      24th May 2010
I would like to include a message box to my macro that prompts user to select
one of two options, or to CANCEL. I know you can create an Answer Box that
provides a Y/N/Cancel option, but I really don't want to use "YES" or "NO".
For example, I'd like the message to say "Would you like to copy your data to
SHEET1 or SHEET2?" Then have buttons labeled SHEET1 / SHEET2 /CANCEL
(instead of YES / NO / CANCEL). Can this be done?
 
Reply With Quote
 
 
 
 
Mike
Guest
Posts: n/a
 
      24th May 2010
You need to create a userform to do what you want. Then on your userform put
a listbox with sheetnames and then the user could select the sheetname from
the listbox and hit ok.

"jday" wrote:

> I would like to include a message box to my macro that prompts user to select
> one of two options, or to CANCEL. I know you can create an Answer Box that
> provides a Y/N/Cancel option, but I really don't want to use "YES" or "NO".
> For example, I'd like the message to say "Would you like to copy your data to
> SHEET1 or SHEET2?" Then have buttons labeled SHEET1 / SHEET2 /CANCEL
> (instead of YES / NO / CANCEL). Can this be done?

 
Reply With Quote
 
SteAXA
Guest
Posts: n/a
 
      24th May 2010
MsgBox(prompt[, buttons] [, title] [, helpfile, context])

In buttons you can use VbYesNoCancel
if user select:
yes msgbox return vbYes (=6),
no msgbox return vbNo (=7),
cancel msgnox return vbCancel (=2).

Ste'
 
Reply With Quote
 
Rick Rothstein
Guest
Posts: n/a
 
      24th May 2010
Or, for the three options the OP asked about, he could use three
CommandButtons in place of the ListBox.

--
Rick (MVP - Excel)



"Mike" <(E-Mail Removed)> wrote in message
news:8B443C2D-E527-413D-88E4-(E-Mail Removed)...
> You need to create a userform to do what you want. Then on your userform
> put
> a listbox with sheetnames and then the user could select the sheetname
> from
> the listbox and hit ok.
>
> "jday" wrote:
>
>> I would like to include a message box to my macro that prompts user to
>> select
>> one of two options, or to CANCEL. I know you can create an Answer Box
>> that
>> provides a Y/N/Cancel option, but I really don't want to use "YES" or
>> "NO".
>> For example, I'd like the message to say "Would you like to copy your
>> data to
>> SHEET1 or SHEET2?" Then have buttons labeled SHEET1 / SHEET2 /CANCEL
>> (instead of YES / NO / CANCEL). Can this be done?


 
Reply With Quote
 
NoSpam@aol.com
Guest
Posts: n/a
 
      24th May 2010
Create a User Form and put whatever buttons you want on it. I put together
a very simple example. I put it at http://sample/sample.xls

On Mon, 24 May 2010 08:53:01 -0700, jday <(E-Mail Removed)>
wrote:

>I would like to include a message box to my macro that prompts user to select
>one of two options, or to CANCEL. I know you can create an Answer Box that
>provides a Y/N/Cancel option, but I really don't want to use "YES" or "NO".
>For example, I'd like the message to say "Would you like to copy your data to
>SHEET1 or SHEET2?" Then have buttons labeled SHEET1 / SHEET2 /CANCEL
>(instead of YES / NO / CANCEL). Can this be done?


 
Reply With Quote
 
Mike
Guest
Posts: n/a
 
      24th May 2010
Your right. I was giving another option. So that maybe in the future the user
would like to paste to worksheet 3 or 4 or 5 ect... the user would not have
to modify the userform.

"Rick Rothstein" wrote:

> Or, for the three options the OP asked about, he could use three
> CommandButtons in place of the ListBox.
>
> --
> Rick (MVP - Excel)
>
>
>
> "Mike" <(E-Mail Removed)> wrote in message
> news:8B443C2D-E527-413D-88E4-(E-Mail Removed)...
> > You need to create a userform to do what you want. Then on your userform
> > put
> > a listbox with sheetnames and then the user could select the sheetname
> > from
> > the listbox and hit ok.
> >
> > "jday" wrote:
> >
> >> I would like to include a message box to my macro that prompts user to
> >> select
> >> one of two options, or to CANCEL. I know you can create an Answer Box
> >> that
> >> provides a Y/N/Cancel option, but I really don't want to use "YES" or
> >> "NO".
> >> For example, I'd like the message to say "Would you like to copy your
> >> data to
> >> SHEET1 or SHEET2?" Then have buttons labeled SHEET1 / SHEET2 /CANCEL
> >> (instead of YES / NO / CANCEL). Can this be done?

>
> .
>

 
Reply With Quote
 
eliano
Guest
Posts: n/a
 
      24th May 2010
On 24 Mag, 18:01, SteAXA <Ste...@discussions.microsoft.com> wrote:
> MsgBox(prompt[, buttons] [, title] [, helpfile, context])
>
> In buttons you can use VbYesNoCancel
> if user select:
> yes msgbox return vbYes (=6),
> no msgbox return vbNo (=7),
> cancel msgnox return vbCancel (=2).
>
> Ste'


Like this ?

Dim reply As VbMsgBoxResult
reply = MsgBox("Yes = Copy data in Sheet1" & _
vbNewLine & _
"No = Copy data in Sheet2" & _
vbNewLine & _
" otherwise Cancel", _
vbYesNoCancel)

Ciao
:-8)
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Auto answer message box csdjj Microsoft Excel Misc 2 5th Aug 2009 06:33 PM
In need of help with an error message...please answer... =?Utf-8?B?ZGVldHVja2VyNDU=?= Windows XP General 3 14th Jun 2007 08:05 PM
Replies contain only my message; not the answer =?Utf-8?B?bWlubmJ1c2dhbA==?= Microsoft Outlook Discussion 4 7th Nov 2005 08:55 PM
Amber - For you or anyone else that can answer this message CJ Taylor Microsoft VB .NET 3 15th Sep 2004 05:19 PM
I want to MS answer about NetMeeting, Again Message. Jenny Windows XP Embedded 2 28th Oct 2003 08:34 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:37 AM.