Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 50
Default Answer Message Box - Other than Y/N?

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?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,101
Default Answer Message Box - Other than Y/N?

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?

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22
Default Answer Message Box - Other than Y/N?

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'
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default Answer Message Box - Other than Y/N?

Or, for the three options the OP asked about, he could use three
CommandButtons in place of the ListBox.

--
Rick (MVP - Excel)



"Mike" wrote in message
...
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?


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 142
Default Answer Message Box - Other than Y/N?

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
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?




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,101
Default Answer Message Box - Other than Y/N?

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" wrote in message
...
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?


.

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 79
Default Answer Message Box - Other than Y/N?

On 24 Mag, 18:01, SteAXA 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
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
During VBA waiting for Message box answer problem Trev B Excel Programming 2 February 13th 10 01:11 PM
Auto answer message box csdjj Excel Discussion (Misc queries) 3 August 5th 09 06:33 PM
Answer an Outlook Express message box ozhunter Excel Worksheet Functions 1 May 22nd 09 02:35 PM
Calculator Answer Doesn't Match Excel Answer GwenH Excel Discussion (Misc queries) 3 October 20th 08 10:17 AM
How do I make the formula see the message box answer? Melody4572 Excel Programming 4 February 5th 07 05:58 PM


All times are GMT +1. The time now is 05:01 PM.

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

About Us

"It's about Microsoft Excel"