#1   Report Post  
Posted to microsoft.public.excel.misc
Wu Wu is offline
external usenet poster
 
Posts: 36
Default msgbox question

In my marco, I want to show a message box to ask " do you have open the
1244.xls file" and to show two button " yes" and "no" for user select.

If user select "yes", my marco will go on,

select "no", it will quit the marco

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,501
Default msgbox question

Hi,

You only need to check the No button

response = MsgBox("Have you opened 1244.xls?", vbYesNo, "Your Title")
If response = vbNo Then Exit Sub

Mike

"Wu" wrote:

In my marco, I want to show a message box to ask " do you have open the
1244.xls file" and to show two button " yes" and "no" for user select.

If user select "yes", my marco will go on,

select "no", it will quit the marco

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,501
Default msgbox question

Hi,

You may want to consider another method that doesn't rely on the user who
could prees the wrong button. This checks if the workbook is open and exits
the sub if it isn't.

Sub marine()
fname = "1244.xls"
On Error Resume Next
Workbooks(fname).Activate
If Err < 0 Then
MsgBox "You must have workbook " & fname & " open to continue.
Exiting"
Exit Sub 'Workbook isn't open
End If
Err.Clear 'Clear errors
End Sub

Mike

"Mike H" wrote:

Hi,

You only need to check the No button

response = MsgBox("Have you opened 1244.xls?", vbYesNo, "Your Title")
If response = vbNo Then Exit Sub

Mike

"Wu" wrote:

In my marco, I want to show a message box to ask " do you have open the
1244.xls file" and to show two button " yes" and "no" for user select.

If user select "yes", my marco will go on,

select "no", it will quit the marco

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
msgbox in VBA peyman Excel Discussion (Misc queries) 6 October 6th 07 09:35 PM
msgbox peyman Excel Discussion (Misc queries) 5 October 4th 07 09:56 PM
msgbox peyman Excel Discussion (Misc queries) 2 September 29th 07 08:21 PM
MsgBox CC Excel Discussion (Misc queries) 4 May 5th 06 05:45 PM
Msgbox Wildman Excel Worksheet Functions 1 April 26th 05 04:57 AM


All times are GMT +1. The time now is 08:38 AM.

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"