Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Button customization

Status
Not open for further replies.

plarocque

MIS
Jul 2, 2003
26
CA
HI,

When using a MsgBox function, is there a way to customize the text on the buttons displayed?

I would like to ask the user a question and the answer is really specific, so instead of using the InputBox, I would like to use the MsgBox and type the different possible answer on different button, so this way the user only have to click to make its choice, instead of typing something that its not so obvious.

Thanks.
 
are you implying that the answer to your question only has 2 possiblities?
if so then cant you say

intReturn = WshShell.Popup("You car can be blue or red, click OK if it is Blue")

then test for intReturn.

but i think the answer is NO, you cant change the button texts, you can change which buttons are displayed, ie, Cancel, OK, or both etc
 
Documented values for MsgBox() buttons parameter:
[tt]
vbOKOnly 0 Display OK button only.
vbOKCancel 1 Display OK and Cancel buttons.
vbAbortRetryIgnore 2 Display Abort, Retry, and Ignore buttons.
vbYesNoCancel 3 Display Yes, No, and Cancel buttons.
vbYesNo 4 Display Yes and No buttons.
vbRetryCancel 5 Display Retry and Cancel buttons.
[/tt]
Those are built-in constants.

There are additional bits in buttons you can set to control the alert icon displayed, which button is the default (selected by the Enter key), etc.

See the VBScript documentation.

I assume this is a WSH script. Since you are clearly writing an interactive desktop script you might consider the richer interface options an HTA offers instead. There are several MsgBox() alternatives or you can create totally custom dialogs.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top