On Sat, 03 Dec 2005 16:59:08 -0800, boofhead wrote:
Can I add my experience in the hope that Microsoft may be tempted to fix
their error generation feature.
My workaround may also be of some use to others.
I use English Regional settings and imported a file to a spreadsheet
using DMY date settings. With VBA I set a string variable s to the
contents of a cell which contained 10/06/2005. When (without further
processing) s was stored in a new location, that cell showed 6/10/2005 -
i.e. it had been converted to US format.
I attempted to force the correct format by interposing
s = FormatDateTime(s,2) but this had no effect. However, changing this
to s= FormatDateTime(s,1) gave Friday, 10 June 2005, which is cumbersome
- but at least it is correct.
boofhead
*** Sent via Developersdex http://www.developersdex.com ***
I'm not certain exactly what you are doing since you've not posted any code.
However, depending on how you "set" a string variable to the contents of a cell
that contains a date, the behavior you describe is not unexpected. VBA is
somewhat US-centric.
Assuming the date is stored properly as an Excel date (e.g. a serial number),
then something like:
dim s as string
s = format(cell,"dd/mm/yy")
should do what you describe.
--ron