[VBA]Convert a string to date

Solved
greenthumb -  
 Oli -
Hello,

I have a problem with dates in VBA...

Let's say I have a string st = "12/03/2009" and I want to convert it to Date...

Does anyone know how to do this?

PS: I am new to VBA

Best regards,

green
Configuration: Windows 2000 Firefox 3.0.7

9 answers

  1. lermite222 Posted messages 9042 Status Contributor 1 199
     
    only useful when...
    MyDate = "February 12, 1969" ' Defines the date.
    MyShortDate = CDate(MyDate) ' Converts to Date type.
    Otherwise, dates written in literal form like 12/12/2008 for example, are automatically considered as a date.
    --
    Experience teaches more surely than advice. (André Gide)
    If you bump into a pot and it sounds hollow, it's not necessarily the pot that's empty. ;-)(Confucius)
    28
    1. Oli
       
      You're welcome!
      0