Pop up box

RichieF

New Member
Joined
Apr 17, 2002
Messages
20
Upon opening an Excel file, I want a pop-up box to appear on screen which contains some text, and which has yes and no option buttons within it. If the person opening the file clicks yes, the excel file opens, and if they click no, it doesn't (ie something similar to a user agreement to certain conditions prior to using the file)

Any ideas what code I need to use to do this ?

Thanks.
 

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
Sub AUTO_OPEN()

TEST = MsgBox("Do You Want to Open This File?",vbyesno,"OPEN?")

IF TEST = VBNO then Exit Sub

End Sub
 
Upvote 0
You can put a message box in the Open event of the workbook module. Something like this:

Code:
Private Sub Workbook_Open()

    If vbNo = MsgBox("Do you agree that you are responsible if this " & _
                      "workbook corrupts your computer and erases your " & _
                      "hard drive?", vbQuestion + vbYesNo, _
                      "Your word is your bond") Then
        ThisWorkbook.Close False
    End If
                      
End Sub

This needs to go in the Workbook Module. For information on how to access the workbook/worksheet modules, click HERE.

Let me know if you can't get it to work.

Hope this helps,

Russell
This message was edited by Russell Hauf on 2002-11-07 14:17
 
Upvote 0

Forum statistics

Threads
1,213,506
Messages
6,114,024
Members
448,543
Latest member
MartinLarkin

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top