String to Date

G

Geoff Edwards

This is Office 97 VBa

I'll spare you the contorted reasoning behind this!

Having constructed a string variable inDate (eg 11/07/04 - which is
dd/mm/yy format for us in the UK) what's the easiest way to make VBa
deal with it as a type Date variable thereafter?

TIA


Geoff Edwards
Leeds, UK

e-mail: (e-mail address removed)
(replace the stopspambot bit with some
version of my name)
 
G

Geoff Edwards

Many thanks.

Hi Geoff

Use The CDate function to convert the string to a date.

Geoff Edwards
Leeds, UK

e-mail: (e-mail address removed)
(replace the stopspambot bit with some
version of my name)
 
J

Jezebel

If you're constructing the string from the day, month, and year values, it's
more reliable to use DateSerial() and go directly to the date than to create
the string and convert that. The danger with string conversion and CDate()
is that it's sensitive to the machine's regional settings.
 

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

Similar Threads

Multi-page tracking 0
Tables 2
If the or Select Case? 4
On Error error in Word 97 coce imported into Word 2003 3
Referencing a user form 10
Check control types 3
Vba Date$ 1
Why doesn't this work????? 0

Top