Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 01-03-2017, 12:37 PM
dwirony dwirony is offline Good morning/afternoon/evening based on time Windows 7 64bit Good morning/afternoon/evening based on time Office 2003
Advanced Beginner
Good morning/afternoon/evening based on time
 
Join Date: Oct 2016
Posts: 49
dwirony will become famous soon enough
Default Good morning/afternoon/evening based on time

Hello again,

I've written some code to autopopulate an email from word to outlook, however I want to add one last feature that adjusts the first line based on what time it is. If it's before 12 p.m. I want it to say good morning, between 12 p.m. and 5 p.m. to say good afternoon, and after 5 p.m. to say evening... However, I'm not sure how to incorporate a date function to create those 3 scenarios... anyone have any idea?
Reply With Quote
  #2  
Old 01-03-2017, 01:01 PM
dwirony dwirony is offline Good morning/afternoon/evening based on time Windows 7 64bit Good morning/afternoon/evening based on time Office 2003
Advanced Beginner
Good morning/afternoon/evening based on time
 
Join Date: Oct 2016
Posts: 49
dwirony will become famous soon enough
Default

Oops. Found a good solution. Here it is:

Code:
Select Case Time
        Case Is < TimeValue("12:00")
            msg = "Good morning"
        Case Is < TimeValue("16:00")
            msg = "Good afternoon"
        Case Else
            msg = "Good evening"
    End Select
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
PPT Progress Bar based on Time not the # of Slides The Dutchman PowerPoint 0 12-14-2016 09:59 AM
filtering a list based clock time DPD16 Excel 8 01-06-2016 03:29 PM
Automatically Delete Slides based on current time Pacman52 PowerPoint 2 07-16-2015 05:30 AM
Good morning/afternoon/evening based on time Good Word-based Document Assembly Software? Grahamers Word 1 05-13-2013 04:42 PM
Good morning/afternoon/evening based on time field value based on time of day akraw Word 3 03-26-2011 08:29 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 01:32 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft