#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default TimeSerial

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


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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,624
Default TimeSerial

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



In article ,
Rockee052 wrote:

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


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

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default TimeSerial

JE,

Thanks, I'll give it a try


Rockee Freeman


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

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default TimeSerial

JE,

Thanks, I'll give it a try


Rockee Freeman


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

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default TimeSerial

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...

Thanks
Rockee Freema

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



  #6   Report Post  
Posted to microsoft.public.excel.programming
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/



  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default TimeSerial

Tom,

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

Thanks,
Rockee Freema

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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 06:54 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"