ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   msg box (https://www.excelbanter.com/excel-programming/333048-msg-box.html)

sip8316

msg box
 
I used the following code with a command button so that a msg box would pop
up and prompt the user to select yes or no, and then call upon another macro
if yes is chosen. However nothing happens when I click yes or no. Below is
my code and thanks for any help

Scott

Private Sub cmdColors_Click()
Dim Msg, Style, Title, Response, MyString

cmdColors.Enabled = False

Msg = "Depending on the size of the spreadsheet and the speed of your
computer this action may take 1 to 5 min. to complete. Do you want to
continue?"
Style = vbYesNo + vbDefaultButton1
Title = "MsgBox Continue"

Reponse = MsgBox(Msg, Style, Title)
If Response = vbYes Then
Call BorderStandard
Else

End If

cmdColors.Enabled = True
End Sub

[email protected]

msg box
 
Scott,

Reponse = MsgBox(Msg, Style, Title) ....Response is spelt wrong.
Are you using Option Explicit?


Toppers

msg box
 
Hi,
Could it be the simple typo in your code:


Reponse = MsgBox(Msg, Style, Title) instead of

ReSponse = MsgBox(Msg, Style, Title)

.... worked OK for me (with change).


HTH


"sip8316" wrote:

I used the following code with a command button so that a msg box would pop
up and prompt the user to select yes or no, and then call upon another macro
if yes is chosen. However nothing happens when I click yes or no. Below is
my code and thanks for any help

Scott

Private Sub cmdColors_Click()
Dim Msg, Style, Title, Response, MyString

cmdColors.Enabled = False

Msg = "Depending on the size of the spreadsheet and the speed of your
computer this action may take 1 to 5 min. to complete. Do you want to
continue?"
Style = vbYesNo + vbDefaultButton1
Title = "MsgBox Continue"

Reponse = MsgBox(Msg, Style, Title)
If Response = vbYes Then
Call BorderStandard
Else

End If

cmdColors.Enabled = True
End Sub


sip8316

msg box
 
Thanks Guys,

I hate it when I do that. I don't know how many times I looked it over and
missed that

Scott

"sip8316" wrote:

I used the following code with a command button so that a msg box would pop
up and prompt the user to select yes or no, and then call upon another macro
if yes is chosen. However nothing happens when I click yes or no. Below is
my code and thanks for any help

Scott

Private Sub cmdColors_Click()
Dim Msg, Style, Title, Response, MyString

cmdColors.Enabled = False

Msg = "Depending on the size of the spreadsheet and the speed of your
computer this action may take 1 to 5 min. to complete. Do you want to
continue?"
Style = vbYesNo + vbDefaultButton1
Title = "MsgBox Continue"

Reponse = MsgBox(Msg, Style, Title)
If Response = vbYes Then
Call BorderStandard
Else

End If

cmdColors.Enabled = True
End Sub


Harald Staff

msg box
 
Put
Option Explicit
on top of all your modules, and the VB editor will tell you those things.

HTH. Best wishes Harald

"sip8316" skrev i melding
...
Thanks Guys,

I hate it when I do that. I don't know how many times I looked it over

and
missed that

Scott





All times are GMT +1. The time now is 11:46 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com