Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


To detect a time format

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,60130
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> To detect a time format
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 To detect a time format - 5/12/2008 8:02:37 PM   
  wmec

 

Posts: 125
Score: 0
Joined: 8/5/2004
From: Hong Kong, China
Status: offline
Hi,
Is there one way, by which we can assure the relevant cell value is in Time format, with VB script?

_____________________________

Thanks & Best Regards,

HuaMin Chen
 
 
Post #: 1
 
 RE: To detect a time format - 5/13/2008 12:23:03 AM   
  dm_4ever


Posts: 2432
Score: 38
Joined: 6/29/2006
From: Orange County, California
Status: offline
Maybe the NumberFormat property...may show as hh:mm:ss

_____________________________

dm_4ever

My philosophy: K.I.S.S - Keep It Simple Stupid
Read Me: http://www.visualbasicscript.com/m_24727/tm.htm
Frequently Asked Stuff: http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to wmec)
 
 
Post #: 2
 
 RE: To detect a time format - 5/13/2008 4:07:21 AM   
  ebgreen


Posts: 4613
Score: 31
Joined: 7/12/2005
Status: offline
IsDate() should work.

_____________________________

"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to wmec)
 
 
Post #: 3
 
 RE: To detect a time format - 5/13/2008 6:54:12 PM   
  wmec

 

Posts: 125
Score: 0
Joined: 8/5/2004
From: Hong Kong, China
Status: offline
It's an invalid case, in which we put 24:00 PM in a time cell. When using Macro to check against this, it's an error which will stop the running Macro. Is there a way, by that we can return a message saying 24:00 is wrong as a time field?

(in reply to ebgreen)
 
 
Post #: 4
 
 RE: To detect a time format - 5/14/2008 12:13:52 AM   
  ebgreen


Posts: 4613
Score: 31
Joined: 7/12/2005
Status: offline
Could you show us some code? Basically, you would need to use On Error Resume Next, If Err.Number <> 0, and On Error Goto 0 to trap the error.

_____________________________

"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to wmec)
 
 
Post #: 5
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> To detect a time format Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts