Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Microsoft Office > Excel VBA > Excel VBA
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old August 8th, 2012, 07:11 AM
Authorized User
Points: 95, Level: 1
Points: 95, Level: 1 Points: 95, Level: 1 Points: 95, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
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")
Reply With Quote
  #2 (permalink)  
Old August 19th, 2012, 10:58 PM
Friend of Wrox
Points: 3,060, Level: 23
Points: 3,060, Level: 23 Points: 3,060, Level: 23 Points: 3,060, Level: 23
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Sep 2005
Location: , , .
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)
Reply With Quote
  #3 (permalink)  
Old August 21st, 2012, 03:59 PM
Authorized User
Points: 95, Level: 1
Points: 95, Level: 1 Points: 95, Level: 1 Points: 95, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
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
Reply With Quote
  #4 (permalink)  
Old August 25th, 2012, 10:09 AM
Friend of Wrox
Points: 3,060, Level: 23
Points: 3,060, Level: 23 Points: 3,060, Level: 23 Points: 3,060, Level: 23
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Sep 2005
Location: , , .
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)
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


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



All times are GMT -4. The time now is 07:32 AM.


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