Private Sub Workbook_Open()
Application.ScreenUpdating = True
'Unhide sheets if macros are enabled
Me.Sheets("Main sheet").Visible = True
Me.Sheets("Main sheet").Visible = True
Me.Sheets("Contact details").Visible = True
Me.Sheets("Vacancy details").Visible = True
Me.Sheets("Additional information").Visible = True
Me.Sheets("Summary").Visible = True
Me.Sheets("ERROR").Visible = False
'Select Main Sheet
Me.Sheets("Main sheet").Select
'Any message to be displayed at startup
'OpenMessage = MsgBox("This is a trial version of the RCR. It will expire on Sunday 1st July. After this you will need to download a live version from HR Help", vbOKOnly, "TRIAL RCR")
Dim CheckDate As Date, TodaysDate As Date
'Set scroll areas
Me.Sheets("Main sheet").Select
Me.Sheets("Main sheet").ScrollArea = "a1:i56"
Me.Sheets("Contact details").ScrollArea = "a1:i20"
Me.Sheets("Vacancy details").ScrollArea = "a1:j56"
Me.Sheets("Additional information").ScrollArea = "a1:i52"
Me.Sheets("Summary").ScrollArea = "a1:i78"
'Shelf Life Section
CheckDate = "30/06/2008" 'This is the date for the Shelf Life. Change this for each new version released.
TodaysDate = Date
'If TodaysDate = CheckDate + 20 Then 'RCR Expires in 10 days
'MsgBox ("This is an old version of the RCR form and will expire in 10 days. Please download the new version from the Intranet")
'ElseIf TodaysDate = CheckDate + 21 Then 'RCR Expires in 9 days
'MsgBox ("This is an old version of the RCR form and will expire in 9 days. Please download the new version from the Intranet")
'ElseIf TodaysDate = CheckDate + 22 Then 'RCR Expires in 8 days
'MsgBox ("This is an old version of the RCR form and will expire in 8 days. Please download the new version from the Intranet")
'ElseIf TodaysDate = CheckDate + 23 Then 'RCR Expires in 7 days
'MsgBox ("This is an old version of the RCR form and will expire in 7 days. Please download the new version from the Intranet")
'ElseIf TodaysDate = CheckDate + 24 Then 'RCR Expires in 6 days
'MsgBox ("This is an old version of the RCR form and will expire in 6 days. Please download the new version from the Intranet")
If TodaysDate = CheckDate - 5 Then 'RCR Expires in 5 days
MsgBox ("This version of the RCR form will expire in 5 days.")
ElseIf TodaysDate = CheckDate - 4 Then 'RCR Expires in 4 days
MsgBox ("This version of the RCR form will expire in 4 days.")
ElseIf TodaysDate = CheckDate - 3 Then 'RCR Expires in 3 days
MsgBox ("This version of the RCR form will expire in 3 days.")
ElseIf TodaysDate = CheckDate - 2 Then 'RCR Expires in 2 days
MsgBox ("This version of the RCR form will expire in 2 days.")
ElseIf TodaysDate = CheckDate - 1 Then 'RCR Expires in 1 day
MsgBox ("This version of the RCR form will expire in 1 days.")
ElseIf TodaysDate = CheckDate Then 'RCR Expires today
MsgBox ("This version of the RCR form expires today.")
ElseIf TodaysDate > CheckDate Then 'RCR Expired
MsgBox ("This version of the RCR form has expired.")
Application.DisplayAlerts = False
ActiveWorkbook.Close
Else
End If
'Disable cut, copy & paste
EnableControl 21, False ' cut
EnableControl 19, False ' copy
EnableControl 22, False ' paste
EnableControl 755, False ' pastespecial
Application.OnKey "^c", "Error"
Application.OnKey "^v", "Error"
Application.OnKey "^x", "Error"
Application.OnKey "+{DEL}", "Error"
Application.OnKey "^{DEL}", "Error"
Application.OnKey "+{INSERT}", "Error"
Application.OnKey "^{INSERT}", "Error"
Application.CellDragAndDrop = False
'Application.OnDoubleClick = "Error"
'Select Main Sheet
Me.Sheets("Main sheet").Select
End Sub