ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Simple meassage box (https://www.excelbanter.com/excel-programming/386521-simple-meassage-box.html)

Les

Simple meassage box
 
Could someone tell me how to have a message box pop up when someone opens a
file. The message box should have 'yes' and 'no' buttons and should be asking
you to check you are in the correct spreadsheet. If 'yes' is selected then
continue on to edit the sheet, if 'no' is selected, then close Excel.
Any help is greatly appreciated.
Thanks.


Bob Phillips

Simple meassage box
 
In the workbook to be opened, add


Private Sub Workbook_Open()
If MsgBox("question", vbYesNo) = vbNo Then
Application.Quit
End If
End Sub

'This is workbook event code.
'To input this code, right click on the Excel icon on the worksheet
'(or next to the File menu if you maximise your workbooks),
'select View Code from the menu, and paste the code


--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"Les" wrote in message
...
Could someone tell me how to have a message box pop up when someone opens
a
file. The message box should have 'yes' and 'no' buttons and should be
asking
you to check you are in the correct spreadsheet. If 'yes' is selected then
continue on to edit the sheet, if 'no' is selected, then close Excel.
Any help is greatly appreciated.
Thanks.




Les

Simple meassage box
 
Cheers Bob

Exactly what I needed.

Regards

Les.


"Bob Phillips" wrote:

In the workbook to be opened, add


Private Sub Workbook_Open()
If MsgBox("question", vbYesNo) = vbNo Then
Application.Quit
End If
End Sub

'This is workbook event code.
'To input this code, right click on the Excel icon on the worksheet
'(or next to the File menu if you maximise your workbooks),
'select View Code from the menu, and paste the code


--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"Les" wrote in message
...
Could someone tell me how to have a message box pop up when someone opens
a
file. The message box should have 'yes' and 'no' buttons and should be
asking
you to check you are in the correct spreadsheet. If 'yes' is selected then
continue on to edit the sheet, if 'no' is selected, then close Excel.
Any help is greatly appreciated.
Thanks.






All times are GMT +1. The time now is 04:20 AM.

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