Using VBA to detect which decimal sign the computer is using

前端 未结 6 1434
你的背包
你的背包 2020-11-30 12:54

Is it possible to use VBA to detect which decimal sign is being used on the computer?

I have a macro script that adds a conditional formatting to an excel sheet. The

6条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-11-30 12:59

    For applications other than Excel, the solution in the accepted answer is not available.

    Instead, you can use Format to retrieve the decimal separator: an unescaped dot in Format gets replaced by the current decimal separator.

    DecimalSeparator = Format(0, ".")
    

    You can also look up the decimal separator from the registry

    DecimalSeparator = CreateObject("WScript.Shell").RegRead("HKCU\Control Panel\International\sDecimal")
    

提交回复
热议问题