From: Brian Murphy on
I am reading a date value from a web page into a string variable. The
web server is in the US so the date will always be in English of the
form May 25, 2010. The month name is spelled out in English.

I need to compare this to a date value stored in a Date variable in
VBA. This is on the user's computer in whatever language and WRS he's
using. How is this done? It seems like some sort of date literal
form like #May 25, 2010# is what I need to do, but how is this done at
run time with a US date in a string variable. I tried
application.evaluate but that did not work.

Thanks,

Brian Murphy
Austin, TX
From: Brian Murphy on
I found the answer in the Green, Bullen, Bovey, Alexander book on
Excel 2007 VBA

VBAdatevbl = CDate(Application.Evaluate("datevalue(""" & UDdatestring
& """)"))

Seems to work like a charm. How those guys figure these things out is
really something.

Cheers,

Brian


On May 26, 1:22 am, Brian Murphy <bmur...(a)xlrotor.com> wrote:
> I am reading a date value from a web page into a string variable.  The
> web server is in the US so the date will always be in English of the
> form May 25, 2010.  The month name is spelled out in English.
>
> I need to compare this to a date value stored in a Date variable in
> VBA.  This is on the user's computer in whatever language and WRS he's
> using.  How is this done?  It seems like some sort of date literal
> form like #May 25, 2010# is what I need to do, but how is this done at
> run time with a US date in a string variable.  I tried
> application.evaluate but that did not work.
>
> Thanks,
>
> Brian Murphy
> Austin, TX

From: Jacob Skaria on
What is the problem with VBScript DateValue Function?

Dim UDDateString As String, VBAdatevbl As Date
UDDateString = "May 25, 2010"
VBAdatevbl = DateValue(UDDateString)

--
Jacob (MVP - Excel)


"Brian Murphy" wrote:

> I found the answer in the Green, Bullen, Bovey, Alexander book on
> Excel 2007 VBA
>
> VBAdatevbl = CDate(Application.Evaluate("datevalue(""" & UDdatestring
> & """)"))
>
> Seems to work like a charm. How those guys figure these things out is
> really something.
>
> Cheers,
>
> Brian
>
>
> On May 26, 1:22 am, Brian Murphy <bmur...(a)xlrotor.com> wrote:
> > I am reading a date value from a web page into a string variable. The
> > web server is in the US so the date will always be in English of the
> > form May 25, 2010. The month name is spelled out in English.
> >
> > I need to compare this to a date value stored in a Date variable in
> > VBA. This is on the user's computer in whatever language and WRS he's
> > using. How is this done? It seems like some sort of date literal
> > form like #May 25, 2010# is what I need to do, but how is this done at
> > run time with a US date in a string variable. I tried
> > application.evaluate but that did not work.
> >
> > Thanks,
> >
> > Brian Murphy
> > Austin, TX
>
> .
>