Excel VBA Checkboxes English vs French

I have an Excel file that needs to deal with checkboxes. The flag names are automatically determined in French (due to the fact that my installation was French). For example, "Case à cocher 100" instead of "Checkbox 100".

However, when our sister company uses this Excel file, it crashes due to their installation in English.

Is there any way to do the following work for English and French?

ActiveSheet.CheckBoxes("Case à cocher 488").Interior.Color = RGB(255, 255, 255)
ActiveSheet.CheckBoxes("Case à cocher 383").Interior.Color = RGB(255, 255, 255)
ActiveSheet.CheckBoxes("Case à cocher 467").Interior.Color = RGB(255, 255, 255)
ActiveSheet.CheckBoxes("Case à cocher 461").Interior.Color = RGB(255, 255, 255)
ActiveSheet.CheckBoxes("Case à cocher 460").Interior.Color = RGB(255, 255, 255)
ActiveSheet.CheckBoxes("Case à cocher 459").Interior.Color = RGB(255, 255, 255)
ActiveSheet.CheckBoxes("Case à cocher 458").Interior.Color = RGB(255, 255, 255)
ActiveSheet.CheckBoxes("Case à cocher 8").Interior.Color = RGB(255, 255, 255)

I cannot find a way to rename the flag name.

+4
source share
1 answer

Check your regional settings and then choose which one to use.

Sub Sample()
    Dim CBNAME As String

    Select Case Application.International(XlApplicationInternational.xlCountryCode)
        Case 1 '<~~ English
            CBNAME = "CheckBox"
        Case 33 '<~~ French
            CBNAME = "Case à cocher"
    End Select

    ActiveSheet.CheckBoxes(CBNAME & " 488").Interior.Color = RGB(255, 255, 255)
End Sub
+7

Source: https://habr.com/ru/post/1678426/


All Articles