VB Code:
  1. Private Sub Workbook_Open()
  2. Sheets("HOME").Activate
  3. Dim bar As CommandBar
  4. For Each bar In Application.CommandBars
  5. bar.Enabled = False
  6. Next
  7. With Application
  8. .DisplayScrollBars = False
  9. .DisplayStatusBar = False
  10. .DisplayFormulaBar = False
  11. End With
  12. With ActiveWindow
  13. .DisplayHeadings = False
  14. .DisplayVerticalScrollBar = False
  15. End With
  16. Load UserForm1
  17. UserForm1.Show
  18. End Sub
  19.  
  20. Private Sub OK()
  21. If ComboBox1 = "ADMINISTRATION" Then
  22. If TextBox1 = "ICT" Then
  23. MsgBox "WELCOME STAFF", vbInformation, "HELLO"
  24. TextBox1 = ""
  25. Dim bar As CommandBar
  26. For Each bar In Application.CommandBars
  27. bar.Enabled = True
  28. Next
  29. With Application
  30. .DisplayStatusBar = True
  31. .DisplayFormulaBar = True
  32. .DisplayScrollBars = True
  33. .CommandBars("Standard").Visible = True
  34. .CommandBars("Formatting").Visible = True
  35. End With
  36. With ActiveWindow
  37. .DisplayGridlines = True
  38. .DisplayHeadings = True
  39. .DisplayVerticalScrollBar = True
  40. .WindowState = xlMaximized
  41. End With
  42. Me.Hide
  43. Else
  44. MsgBox "PLEASE TYPE CORRECT PASSWORD. USE CAPITAL LETTERS WHEN NEEDED.", vbInformation, "ACCESS DENIED!"
  45. TextBox1 = ""
  46. TextBox1.SetFocus
  47. End If
  48. End If
  49. If ComboBox1 = "CUSTOMER" Then
  50. TextBox1.Value = "NoPass"
  51. MsgBox "WELCOME TO TECHNO WORLD", vbInformation, "HELLO GUESTS!"
  52. TextBox1 = ""
  53. Me.Hide
  54. Else
  55. TextBox1 = ""
  56. End If
  57. End Sub
  58.  
  59. Private Sub Cancel()
  60. ActiveWindow.Close
  61. End Sub
  62.  
  63. Private Sub TextBox1_Change()
  64. TextBox1.PasswordChar = "*"
  65. End Sub
  66.  
  67. Private Sub UserForm_Initialize()
  68. With ComboBox1
  69. .AddItem "ADMINISTRATION"
  70. .AddItem "CUSTOMER"
  71. End With
  72. ComboBox1 = ""
  73. End Sub
  74.  
  75. Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
  76. If Cancel <> 1 Then
  77. Cancel = 1
  78. End If
  79. End Sub

Can anyone help me make this code any shorter/simpler.

Thanx in advance,
Greyskull