ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   date handling problem with International issues (https://www.excelbanter.com/excel-programming/442817-date-handling-problem-international-issues.html)

Brian Murphy

date handling problem with International issues
 
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

Brian Murphy

date handling problem with International issues
 
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 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



Jacob Skaria

date handling problem with International issues
 
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 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


.



All times are GMT +1. The time now is 05:13 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com