Here it is...I've tried to make it as readable as possible:
MICROSOFT EXCEL OBJECTS:
THIS WORKBOOK:
Private Sub Workbook_Open()
Call DisableCut
End Sub
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Call EnableCut
End Sub
Private Sub Workbook_BeforePrint(Cancel As Boolean)
If PrtOK Then
Cancel = False
Else
MsgBox "Can't print from here! Use the PRINT TIMESHEET button", vbInformation, "Timesheet Restriction"
Cancel = True
End If
End Sub
////////////////////////////////////////////////////////////////////////
FORMS:
Private Sub UserForm_Initialize()
Dim TitleTxt As String
TitleTxt = "Operations Staff"
With Me.ComboBox1
.AddItem "Operations Staff"
.AddItem "Kitchen Staff"
' .Text = TitleTxt
End With
With Me.ComboBox2
.AddItem Worksheets("EInfo").Range("E4")
.AddItem Worksheets("EInfo").Range("E5")
.AddItem Worksheets("EInfo").Range("E6")
.AddItem Worksheets("EInfo").Range("E7")
.AddItem Worksheets("EInfo").Range("E8")
.Text = Worksheets("EInfo").Range("E6")
End With
With Me.ComboBox4
.AddItem "Full Time Employees"
.Text = "Full Time Employees"
End With
End Sub
Private Sub ComboBox1_Change()
With ComboBox3
.Clear
If ComboBox1.Text = "Operations Staff" Then
.AddItem ""
.AddItem "Anthony"
.AddItem "John"
End If
If ComboBox1.Text = "Kitchen Staff" Then
.AddItem ""
.AddItem "Debra"
.AddItem "Eric"
End If
.ListIndex = 0
End With
End Sub
Private Sub CommandButton1_Click()
Me.Hide
Worksheets("EInfo").Range("H4").Formula = Me.ComboBox1.Text
Worksheets("EInfo").Range("D4").Formula = Me.ComboBox2.Text
Worksheets("EInfo").Range("K4").Formula = Me.ComboBox3.Text
Worksheets("EInfo").Range("I4").Formula = Me.ComboBox4.Text
Worksheets("EInfo").Range("A5").Formula = Me.TextBox1.Text
Worksheets("EInfo").Range("A6").Formula = Me.TextBox2.Text
Worksheets("EInfo").Range("A7").Formula = Me.TextBox3.Text
Worksheets("EInfo").Range("B4").Formula = Me.TextBox4.Text
Unload Me
Range("D12").Select
End Sub
Private Sub CommandButton2_Click()
Me.Hide
Unload Me
Range("D12").Select
End Sub
////////////////////////////////////////////////////////////////////////
MODULES:
Sub GetEmployeeInfo()
frmEmployeeInfo.Show
End Sub
Sub Quit()
Application.DisplayAlerts = False
Application.Quit
End Sub
Sub ClearTimesheetTimes()
Application.ScreenUpdating = False
ActiveSheet.Unprotect Password:="ABCDEFG"
Range("D12:E25,D28:E41,I12:L25,I28:L41,N12:V25,N28:V41,Z12:AE25,Z28:AE41").ClearContents
Sheets("EInfo").Range("A5:A7,B4,D4,H4,I4,K4").ClearContents
ActiveSheet.CheckBoxes.Value = xlOff
Range("D12").Select
ActiveSheet.Protect Password:="ABCDEFG"
End Sub
Sub PrintTimeSheet()
ActiveSheet.Unprotect Password:="ABCDEFG"
Application.ScreenUpdating = False
Range("D14:AE15,D18:AE19,D22:AE23,D30:AE31,D34:AE35,D38:AE39").Interior.ColorIndex = 15
Range("D12:AE13,D16:AE17,D20:AE21,D24:AE25,D28:AE29,D32:AE33,D36:AE37,D40:AE41").Interior.ColorIndex = x1None
Columns("F").Hidden = True
Call PrintNow
ActiveWindow.SelectedSheets.PrintOut Copies:=1
Call DontPrintNow
Columns("F").Hidden = False
Range("D12:E25,D28:E41,I12:L25,I28:L41,N12:V25,N28:V41,Z12:AE25,Z28:AE41").Interior.ColorIndex = 19
ActiveSheet.Protect Password:="ABCDEFG"
Range("D12").Select
End Sub
Public PrtOK As Boolean
Sub PrintNow()
PrtOK = True
End Sub
Sub DontPrintNow()
PrtOK = False
End Sub
Sub DisableCut()
On Error Resume Next
Application.CommandBars("Standard").Controls.Item("Cut").Enabled = False
Application.CommandBars("Edit").Controls.Item("Cut").Enabled = False
Application.CommandBars("Cell").Controls("Cut").Enabled = False
Application.OnKey "^x", "NoNo"
End Sub
Sub EnableCut()
Application.CommandBars("Standard").Controls.Item("Cut").Enabled = True
Application.CommandBars("Edit").Controls.Item("Cut").Enabled = True
Application.CommandBars("Cell").Controls("Cut").Enabled = True
Application.OnKey "^x"
End Sub
Sub NoNo()
MsgBox ("ctrl + x has been disabled.") & Chr(13) & ("You cannot use the keyboard CUT command."), vbInformation, "Timesheet Restriction"
End Sub
/////////////////////////////////////////////////////////////////////////////////////
I know this is alot to go through...any help will be greatly appreciated.
Jamie