Greyskull
Mar 24th, 2004, 08:09 AM
Private Sub Workbook_Open()
Sheets("HOME").Activate
Dim bar As CommandBar
For Each bar In Application.CommandBars
bar.Enabled = False
Next
With Application
.DisplayScrollBars = False
.DisplayStatusBar = False
.DisplayFormulaBar = False
End With
With ActiveWindow
.DisplayHeadings = False
.DisplayVerticalScrollBar = False
End With
Load UserForm1
UserForm1.Show
End Sub
Private Sub OK()
If ComboBox1 = "ADMINISTRATION" Then
If TextBox1 = "ICT" Then
MsgBox "WELCOME STAFF", vbInformation, "HELLO"
TextBox1 = ""
Dim bar As CommandBar
For Each bar In Application.CommandBars
bar.Enabled = True
Next
With Application
.DisplayStatusBar = True
.DisplayFormulaBar = True
.DisplayScrollBars = True
.CommandBars("Standard").Visible = True
.CommandBars("Formatting").Visible = True
End With
With ActiveWindow
.DisplayGridlines = True
.DisplayHeadings = True
.DisplayVerticalScrollBar = True
.WindowState = xlMaximized
End With
Me.Hide
Else
MsgBox "PLEASE TYPE CORRECT PASSWORD. USE CAPITAL LETTERS WHEN NEEDED.", vbInformation, "ACCESS DENIED!"
TextBox1 = ""
TextBox1.SetFocus
End If
End If
If ComboBox1 = "CUSTOMER" Then
TextBox1.Value = "NoPass"
MsgBox "WELCOME TO TECHNO WORLD", vbInformation, "HELLO GUESTS!"
TextBox1 = ""
Me.Hide
Else
TextBox1 = ""
End If
End Sub
Private Sub Cancel()
ActiveWindow.Close
End Sub
Private Sub TextBox1_Change()
TextBox1.PasswordChar = "*"
End Sub
Private Sub UserForm_Initialize()
With ComboBox1
.AddItem "ADMINISTRATION"
.AddItem "CUSTOMER"
End With
ComboBox1 = ""
End Sub
Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
If Cancel <> 1 Then
Cancel = 1
End If
End Sub
Can anyone help me make this code any shorter/simpler.
Thanx in advance,
Greyskull:wave:
Sheets("HOME").Activate
Dim bar As CommandBar
For Each bar In Application.CommandBars
bar.Enabled = False
Next
With Application
.DisplayScrollBars = False
.DisplayStatusBar = False
.DisplayFormulaBar = False
End With
With ActiveWindow
.DisplayHeadings = False
.DisplayVerticalScrollBar = False
End With
Load UserForm1
UserForm1.Show
End Sub
Private Sub OK()
If ComboBox1 = "ADMINISTRATION" Then
If TextBox1 = "ICT" Then
MsgBox "WELCOME STAFF", vbInformation, "HELLO"
TextBox1 = ""
Dim bar As CommandBar
For Each bar In Application.CommandBars
bar.Enabled = True
Next
With Application
.DisplayStatusBar = True
.DisplayFormulaBar = True
.DisplayScrollBars = True
.CommandBars("Standard").Visible = True
.CommandBars("Formatting").Visible = True
End With
With ActiveWindow
.DisplayGridlines = True
.DisplayHeadings = True
.DisplayVerticalScrollBar = True
.WindowState = xlMaximized
End With
Me.Hide
Else
MsgBox "PLEASE TYPE CORRECT PASSWORD. USE CAPITAL LETTERS WHEN NEEDED.", vbInformation, "ACCESS DENIED!"
TextBox1 = ""
TextBox1.SetFocus
End If
End If
If ComboBox1 = "CUSTOMER" Then
TextBox1.Value = "NoPass"
MsgBox "WELCOME TO TECHNO WORLD", vbInformation, "HELLO GUESTS!"
TextBox1 = ""
Me.Hide
Else
TextBox1 = ""
End If
End Sub
Private Sub Cancel()
ActiveWindow.Close
End Sub
Private Sub TextBox1_Change()
TextBox1.PasswordChar = "*"
End Sub
Private Sub UserForm_Initialize()
With ComboBox1
.AddItem "ADMINISTRATION"
.AddItem "CUSTOMER"
End With
ComboBox1 = ""
End Sub
Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
If Cancel <> 1 Then
Cancel = 1
End If
End Sub
Can anyone help me make this code any shorter/simpler.
Thanx in advance,
Greyskull:wave: