Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Outlook / Programming Forms / April 2007

Tip: Looking for answers? Try searching our database.

Displaying Date as a number

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Murphybp2 - 24 Apr 2007 18:49 GMT
I am trying to figure out how to display the date time stamp of a task
as a decimal number.  I want to use this as an ID number for the task
I found a way using VBA where when an email is recieved, the VBA will
copy the email to a new task, and then populate the ID number field
with the date timestamp in the correct format.  The code I used for
that was  olTask.UserProperties.Find("ID Number") =
(Left(Right(CDec(Now()), 14), 9)).  I wanted to shrink the number,
that is why I used the left and right functions.

However there are times when a task could be created without using the
VBA script, so I tried to set the initial value of that field using
the same code, but it's not working.  The results displays as
"09/14/2007 1:40:00 PM" instead of "195.70333".  The field is a text
field, and the property is also text.  I've tried playing with both of
these but can't seem to get it to work.  Any suggestions on how to fix
this would be appreciated.
Sue Mosher [MVP-Outlook] - 30 Apr 2007 18:42 GMT
Try CDbl() instead of CDec().

Signature

Sue Mosher, Outlook MVP
  Author of Configuring Microsoft Outlook 2003
    http://www.turtleflock.com/olconfig/index.htm
  and Microsoft Outlook Programming - Jumpstart for
    Administrators, Power Users, and Developers
    http://www.outlookcode.com/jumpstart.aspx
 

>I am trying to figure out how to display the date time stamp of a task
> as a decimal number.  I want to use this as an ID number for the task
[quoted text clipped - 12 lines]
> these but can't seem to get it to work.  Any suggestions on how to fix
> this would be appreciated.
Murphybp2 - 30 Apr 2007 19:38 GMT
That did it.  What does that function do differently than CDec()?

On Apr 30, 1:42 pm, "Sue Mosher [MVP-Outlook]"
<sue...@outlookcode.com> wrote:
> Try CDbl() instead of CDec().
>
[quoted text clipped - 24 lines]
>
> - Show quoted text -
Sue Mosher [MVP-Outlook] - 30 Apr 2007 21:38 GMT
It converts the number in a different way. I don't really know why it works and CDec doesn't.

Signature

Sue Mosher, Outlook MVP
  Author of Configuring Microsoft Outlook 2003
    http://www.turtleflock.com/olconfig/index.htm
  and Microsoft Outlook Programming - Jumpstart for
    Administrators, Power Users, and Developers
    http://www.outlookcode.com/jumpstart.aspx
 

> That did it.  What does that function do differently than CDec()?
>
[quoted text clipped - 20 lines]
>>
>> - Show quoted text -
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.