_Excel_Rangeread将带逗号的数字转换为小数点

时间:2015-08-27 08:59:52

标签: excel point autoit comma

对于自动化过程,我需要使用_Excel_RangeRead()从Excel读取值并将它们粘贴到只接受逗号作为十进制分隔符的程序中。我在Excel中使用逗号分隔小数,但Excel_RangeRead将这些逗号转换为点。所以我需要3,14并在Excel中使用它,但Excel_rangeRead将其转换为3.14。有没有办法防止这种情况发生或将其转换回来?

提前致谢。

1 个答案:

答案 0 :(得分:0)

如果你这样做它应该工作:使用参数3

#include <Excel.au3>
#include <MsgBoxConstants.au3>
Local $oExcel = _Excel_Open(False)
If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_RangeRead Example", "Error creating the Excel application object." & @CRLF & "@error = " & @error & ", @extended = " & @extended)
Local $oWorkbook = _Excel_BookOpen($oExcel, "c:\Autoit\ForumTests\ExcelRead.xlsx")
If @error Then
    _Excel_Close($oExcel)
    Exit
EndIf

Local $aResult = _Excel_RangeRead($oWorkbook, Default, 'A1', 3)
If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_RangeRead Example 3", "Error reading from workbook." & @CRLF & "@error = " & @error & ", @extended = " & @extended)
ConsoleWrite($aResult & @CRLF)