Displaying Date as a number

M

Murphybp2

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.
 
S

Sue Mosher [MVP-Outlook]

Try CDbl() instead of CDec().

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
S

Sue Mosher [MVP-Outlook]

It converts the number in a different way. I don't really know why it works and CDec doesn't.

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top