Thread: TimeSerial
View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default TimeSerial

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.


--
Regards,
Tom Ogilvy



Rockee052 wrote in message
...
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 working
correctly...

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

Thanks
Rockee Freeman


---
Message posted from http://www.ExcelForum.com/