Library.ConvertLocale

This function converts a spreadsheet formula or selection condition expression between US locale and local regional setting.

Syntax Parameters Return Value
Function Library.ConvertLocale( _
    formula As String, _
    opt As ConvertLocaleOpt) As String
  • formula [in]

The formula to convert.

Type: String

  • opt [in]

How to format the formula.

Type: ConvertLocaleOpt

String

SVB Example

Formatting a formula to work under different locales:

Option Explicit
Option Base 1
Sub Main
    'If your regional settings are set to something like German, then assigning "=Min(v1, 25.7)"
    'as a formula to a spreadsheet will fail. Calling ConvertLocale will properly format
    'the formula so that the parser will understand it. For example, it may reformat "=Min(v1, 25.7)"
    'into "=Min(v1; 25,7)".
    ActiveDataSet.VariableLongName(2) = Application.ConvertLocale("=Min(v1, 25.7)", scToInternational)
    ActiveDataSet.Recalculate
End Sub