Date control in word 2010

Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

lorrdwolf

Thread Starter
Joined
Nov 15, 2011
Messages
1
I am having trouble getting my date control to work properly. I am using Word 2010. I have added a reference to Microsoft Windows Common Controls-2 6.0 (SP6), I have added the date picker control to my tool box. I have added the date controls to my form and I named my date controls dtDate1 & dtDate2. My code is this:

Code:
Dim datDate1 as Date, datDate2 as Date
datDate1 = dtDate1
datDate2 = dtDate2
Msgbox = "Date 1 is " & datDate1
Msgbox = "Date 2 is " & datDate2
When I run this and enter the appropriate dates into the form, I get "Date 1 is 12:00:00 AM" and "Date 2 is 12:00:00 AM". I do not get dates, I get times. Both controls are set to the format dtpShortDate.

I also tried

Code:
Dim datDate1 as Date, datDate2 as Date
datDate1 = CDate(dtDate1)
datDate2 = CDate(dtDate2)
Msgbox = "Date 1 is " & datDate1
Msgbox = "Date 2 is " & datDate2
with the same result.
I need to grab the dates and manipulate them elsewhere in the code. Please, any help would be greatly appreciated.

Thank you.
 
Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 807,865 other people just like you!

Latest posts

Members online

Top