Date Picker in email

Status
Not open for further replies.

PegR

New Member
Outlook version
Outlook 2013 32 bit
Email Account
IMAP
I send out work schedules to staff through email. Is there any way to use a "date picker" (such as in Word or Excel) in the body of the email to minimize errors with the day and date? For example, if I type 3/11/16, want it to change the format to Thursday, March 11, 2016. I use Outlook 2010 or 2013. We do not use an Exchange server; all of the recipients will use personal emails (not our company email) and use a variety of email clients. Is there an addin that would help me? I don't know how to use VBA coding very well, but am willing to try. Any suggestions would be appreciated.
 

PegR

New Member
Outlook version
Outlook 2013 32 bit
Email Account
IMAP
Diane,
Thanks for your quick response. I seldom use today's date, they are always dates in the future. So, it sounds like a macro for me...I will keep searching. I would appreciate if you do find one you could direct me to it and a way I can teach myself how to use it.
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
Some things are more fun than work... :)

This works in an open message - you need to select the date in the message and run the macro (its not fully automated). 3/10/16 works as does 3/10 or the full short date 3/10/2016. the format can be tweaked as needed. Examples:
objSel = Format(myDate, "dddd, mmmm d, yyyy") returns Monday, April 11, 2016
objSel = Format(myDate, "ddd, mmm-d-yyyy ") returns Mon, Jul-11-2016 and adds a space at the end

It might be easier to use an inputbox - much like the insert date dialog, you'd trigger the macro and enter a date in an dialogbox instead of typing it then selecting it and running the macro.

basics of using a macro are here - How to use Outlook's VBA Editor I'll write this macro up as an article because it's kind of cool. :) Won't be before the weekend though, because I'm supposed ot be doing something else right now. :(

Code:
Sub CopyPasteDate()
On Error Resume Next
     
Dim objItem As Object
Dim objInsp As Outlook.Inspector
Dim objWord As Word.Application
Dim objDoc As Word.Document
Dim objSel As Word.Selection
Dim myDate As Date
Dim DataObj As MSForms.DataObject
Set DataObj = New MSForms.DataObject

Set objItem = Application.ActiveInspector.CurrentItem
Set objInsp = objItem.GetInspector
Set objDoc = objInsp.WordEditor
Set objWord = objDoc.Application
Set objSel = objWord.Selection
    
     objSel.Copy
DataObj.GetFromClipboard
myDate = DataObj.GetText(1)
objSel = Format(myDate, "dddd, mmmm d, yyyy")
Set objItem = Nothing
Set objInsp = Nothing
Set objDoc = Nothing
Set objWord = Nothing
Set objSel = Nothing
End Sub
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
Oh, and you need to set a reference to both word and msforms

This has a screenshot of the references dialog - Use Word Macro to Apply Formatting to Email
For forms, add C:\Windows\System32\FM20.dll as a reference. (click browse in the reference dialog then paste the path in the field)
 
Status
Not open for further replies.
Top