A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Hour addition



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old July 27th 07, 04:19 PM posted to autodesk.autocad.customization.vba,microsoft.public.access.modulesdaovba,microsoft.public.outlook.program_vba
Al[_2_]
external usenet poster
 
Posts: 2
Default Hour addition

We have a program that trends our current plant steam usage and uses VBA
for applications. I'd like to use the do...loop and loop it until I reach
a time 8 hours away.

How do I add 8 hours to the currect time?

Thanks
Ads
  #2  
Old July 27th 07, 04:28 PM posted to autodesk.autocad.customization.vba,microsoft.public.access.modulesdaovba,microsoft.public.outlook.program_vba
fredg
external usenet poster
 
Posts: 1
Default Hour addition


"Al" wrote in message
9.11...
We have a program that trends our current plant steam usage and uses VBA
for applications. I'd like to use the do...loop and loop it until I reach
a time 8 hours away.

How do I add 8 hours to the currect time?

Thanks


I have no idea what you mean by using a do..loop for this purpose,
but to add 8 hours to the current time, use:
=DateAdd("h",8,Now())

Fred


  #3  
Old July 27th 07, 04:30 PM posted to autodesk.autocad.customization.vba,microsoft.public.access.modulesdaovba,microsoft.public.outlook.program_vba
Brendan Reynolds
external usenet poster
 
Posts: 1
Default Hour addition

"Al" wrote in message
9.11...
We have a program that trends our current plant steam usage and uses VBA
for applications. I'd like to use the do...loop and loop it until I reach
a time 8 hours away.

How do I add 8 hours to the currect time?

Thanks



You don't need to loop to add eight hours to the current time, but you may
need it if you want to do something for each of the eight hours, so here are
examples with and without looping. See 'DateAdd Function' in the help files
for more information.

Public Sub EightHoursFromNow()

Dim dtmNow As Date

dtmNow = Now()
Dim intLoop As Integer

Debug.Print "No looping required: " & DateAdd("h", 8, dtmNow)
Debug.Print "------------------------------------------------"
Debug.Print "Starting loop"
For intLoop = 0 To 8
Debug.Print intLoop, DateAdd("h", intLoop, dtmNow)
Next intLoop

End Sub

--
Brendan Reynolds

  #4  
Old July 27th 07, 04:34 PM posted to autodesk.autocad.customization.vba,microsoft.public.access.modulesdaovba,microsoft.public.outlook.program_vba
Graham R Seach
external usenet poster
 
Posts: 1
Default Hour addition

Al,

No need for a loop:
dteMyTime = DateAdd("h", 8, dteMyTime)

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia


"Al" wrote in message
9.11...
We have a program that trends our current plant steam usage and uses VBA
for applications. I'd like to use the do...loop and loop it until I reach
a time 8 hours away.

How do I add 8 hours to the currect time?

Thanks


  #5  
Old July 27th 07, 04:36 PM posted to microsoft.public.access.modulesdaovba,microsoft.public.outlook.program_vba
Paolo
external usenet poster
 
Posts: 12
Default Hour addition

Hi Al,

Format(DateAdd("h", 8, Now), "hh:mm:ss")

HTH Paolo

"Al" wrote:

We have a program that trends our current plant steam usage and uses VBA
for applications. I'd like to use the do...loop and loop it until I reach
a time 8 hours away.

How do I add 8 hours to the currect time?

Thanks

  #6  
Old August 1st 07, 03:25 PM posted to autodesk.autocad.customization.vba,microsoft.public.access.modulesdaovba,microsoft.public.outlook.program_vba
Al[_2_]
external usenet poster
 
Posts: 2
Default Hour addition

Al wrote in
9.11:

We have a program that trends our current plant steam usage and uses
VBA for applications. I'd like to use the do...loop and loop it until
I reach a time 8 hours away.

How do I add 8 hours to the currect time?

Thanks


Thanks to all who responded, You all were correct in that I had no need
for the loop, It is work well, I just have to fine tune it now.
 




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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
can i change the default meeting time from 1/2 hour to 1 hour? Sarah Outlook - Calandaring 2 June 8th 07 02:43 AM
Automating the addition of a public folder to OAB [cc]smart Outlook - Using Contacts 3 October 31st 06 06:55 PM
Addition of newsgroup Sybil Fox Outlook Express 3 June 10th 06 01:20 PM
Adding additional text to an appointment in addition to the subjec Aly Outlook - Calandaring 3 March 10th 06 02:22 PM
Even with transform addition, user's don't get Outlook Address Sue Mosher [MVP-Outlook] Outlook - Using Contacts 0 January 20th 06 06:42 PM


All times are GMT +1. The time now is 09:01 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.