I have a macro which creates an excel formula
range("A2").formula="=TEXT(A1,""YYYYMMDD"")"
this works well with my US-EN version but gives problem when I try to run it on FR-FR version
I need to adapt the formula to
range("A2").formula="=TEXT(A1,""AAAAMMJJ"")"
to have it work correctly on a -FR-FR version but this no longer works on my US-En version.
Any idea about how to manage this?
I have the same kind of issue with the CELL and INFO functions which use a string parameter that is language-dependent but not managed correctly when the formula is created programmatically thru the formula property of the range function.
Is there a property that I can test on and adapt the formula accordingly or better is there a way to have the string parameter automatically translated?
You can access the local regional settings via the
Application.International
method. This can then be used to translate your US_EN code to Local settings code.Something like this
Then use it like this