TimeSerial

  • Thread starter Thread starter Rockee052
  • Start date Start date
R

Rockee052

HI,

What would be the correct way to use a time serial between two time. I
need to set it up where the time are equivalent to everything after 8am
- Noon..


I have tried this
Case Is <> TimeSerial(13, 0, 0) & TimeSerial(7, 0, 0)

I don't think this is right?

Thanks

Rockee Freeman
 
One way:

Case TimeSerial(8, 0, 0) To TimeSerial(12, 0, 0)

would include both 8:00 and 12:00

Case TimeSerial(8, 0, 1) To TimeSerial(11, 59, 59)

would exclude both 8:00 and 12:00
 
JE or Anyone,

This is my code:
Private Sub Workbook_BeforePrint(Cancel As Boolean)
Select Case Time
Case Is <> TimeSerial(13, 0, 0) & TimeSerial(8, 0, 0)
Beep
msg = "You do not need to print at this time!"
Ans = MsgBox(msg, vbInformation, "Cannot Print...")
Cancel = True
End Select
Exit Sub
msg = "Is the Shift Labor Report completed and accurate?"
Ans = MsgBox(msg, vbYesNo, "About to print...")
If Ans = vbNo Then Cancel = True
End Sub

I tried putting in:

Case TimeSerial(8, 0, 1) To TimeSerial(11, 59, 59)

I received an error, what do I need to change to get my code workin
correctly...

What I'm trying do is stop some employees from printing a report out
anytime after 8am-Noon...:confused:

Thanks
Rockee Freema
 
Private Sub Workbook_BeforePrint(Cancel As Boolean)
Select Case Time
Case TimeSerial(8, 0, 0) To TimeSerial(12, 0, 0)
Beep
msg = "You do not need to print at this time!"
Ans = MsgBox(msg, vbInformation, "Cannot Print...")
Cancel = True
Exit Sub
Case Else
msg = "Is the Shift Labor Report completed and accurate?"
Ans = MsgBox(msg, vbYesNo, "About to print...")
If Ans = vbNo Then Cancel = True
End Select
End Sub


Worked for me.
 
Tom,

When I adjusted the code I put:
Case Is
Instead of Case (whoops)

Thanks,
Rockee Freema
 
Back
Top