Wrox Programmer Forums
|
Excel VBA Discuss using VBA for Excel programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Excel VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 8th, 2012, 07:11 AM
Authorized User
 
Join Date: Jan 2012
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Default userform+time

I have a userform that displays the Test time(or current time) .caption in a label. Then I have a textbox asking the user for the time product was pulled. Before the product can be tested it has to sit out for at least an hour after its been pulled. Is there a way within vba to subtract the difference between the test time and the time it was pulled and if the time difference is less then one hour dispaly a message box stating you have "xx" minutes left before product can be tested. Thanks to all for your help.

'Sets Test Time
Label4.Caption = Format(Time, "hh:mm")
 
Old August 19th, 2012, 10:58 PM
Friend of Wrox
 
Join Date: Sep 2005
Posts: 812
Thanks: 1
Thanked 53 Times in 49 Posts
Default

Hi

You can use the combination of Sleep function and DateDiff to dynamically display the 'Time elapsed' or 'Time Left ..' on your user form.

Cheers
Shasur
__________________
C# Code Snippets (http://www.dotnetdud.blogspot.com)

VBA Tips & Tricks (http://www.vbadud.blogspot.com)
 
Old August 21st, 2012, 03:59 PM
Authorized User
 
Join Date: Jan 2012
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Default

can you give please give a tested example? Especially comparing to see if the elapsed time is greater or less than 1 hour. Thanks
 
Old August 25th, 2012, 10:09 AM
Friend of Wrox
 
Join Date: Sep 2005
Posts: 812
Thanks: 1
Thanked 53 Times in 49 Posts
Default

Hi

Here is a sample

dStart = "25-08-2012 18:37:03" ' Change This to the App start time Variabled
if DAteDiff("h", dStart, Now()) > 1 then
' Elasped Time > 1
End if

Cheers
Shasur
__________________
C# Code Snippets (http://www.dotnetdud.blogspot.com)

VBA Tips & Tricks (http://www.vbadud.blogspot.com)





Similar Threads
Thread Thread Starter Forum Replies Last Post
Userform pescioletto Excel VBA 3 September 5th, 2011 10:26 AM
Time format problem in userform frankjuel Excel VBA 1 October 10th, 2007 08:34 AM
Remove UserForm lostthought Excel VBA 0 July 29th, 2004 12:47 PM
Remove UserForm lostthought VB How-To 0 July 29th, 2004 12:46 PM
Using icons within a userform Stubby Excel VBA 2 July 7th, 2004 08:09 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.