Home |
Search |
Today's Posts |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Marcello,
First you will have to create the userform with the buttons and textboxes that you want. Then call the userform in the workbook_open event. Private Sub Workbook_Open() UserFrom1.Show End Sub The code for the Submit button might look something like this: Private Sub CommandButton1_Click() Dim Str_Password As String Str_Password = Sheets(1).Range("A1") 'You would of course have this sheet hidden. You could also set the password here by replacing the Sheets(1).Range("A1") with "Password", or what ever you select for the password. If TextBox1 = Str_Password Then Unload Me End If If TextBox1 < Str_Password Then Msgbox "Sorry, but you have entered an incorrect password. Please re-enter the correct password.",vbOkayOnly + vbCritical TextBox1 = "" TextBox1.SetFocus Exit Sub End If End Sub The code for the Cancel button might look something like this: Private Sub CommandButton2_Click() Application.DisplayAlerts = False Application.Quit End Sub Hope this helps. --- Message posted from http://www.ExcelForum.com/ |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Can I protect all excel tabs in a file with one password entry? | Excel Discussion (Misc queries) | |||
sql server password entry during macro run | Excel Discussion (Misc queries) | |||
password protecting a column for data entry in a sheet, how? | Excel Worksheet Functions | |||
How can I add a PASSWORD entry box to my EXCEL app using VBA | Excel Programming | |||
How to create a PASSWORD ENTRY BOX at startup of Excel Application | Excel Programming |