If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
how do i set up a user prompt at the start of an excel workbook ?
I need to create a security feature which requests the users agreement prior
to entering into a worksheet. How do I do that? |
#2
|
|||
|
|||
how do i set up a user prompt at the start of an excel workbook ?
Mark,
Right click the sheet tab of the sheet you want to protect, View code and paste the code below in. Change the ProtectedSheet to the correct sheet name and the outsheet variable to where you want to go if the user doesn't agree. A couple of points. If macros aren't enabled it won't work and it provides very little security because Excel security is weak. Private Sub Worksheet_Activate() msg = "Do you agree to the terms and conditions. Y/N?" ttl = "User Agreement" Set ProtectedSheet = Sheets("Sheet1") 'Change to suit Set OutSheet = Sheets("Sheet2") 'Change to suit ProtectedSheet.Visible = False response = MsgBox(msg, vbYesNo, ttl) Application.EnableEvents = False If response = vbYes Then ProtectedSheet.Visible = True ProtectedSheet.Activate Else OutSheet.Activate ProtectedSheet.Visible = True End If Application.EnableEvents = True End Sub -- Mike When competing hypotheses are otherwise equal, adopt the hypothesis that introduces the fewest assumptions while still sufficiently answering the question. "Mark" wrote: I need to create a security feature which requests the users agreement prior to entering into a worksheet. How do I do that? |
Thread Tools | |
Display Modes | |
|
|