【问题标题】:_Excel_Rangeread converts numbers with comma to decimal points_Excel_Rangeread 将带逗号的数字转换为小数点
【发布时间】:2015-11-21 13:46:42
【问题描述】:

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

提前致谢。

【问题讨论】:

    标签: excel point autoit comma


    【解决方案1】:

    如果你这样做,它应该可以工作:使用参数 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)
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-01-04
      • 2015-01-25
      • 2020-04-21
      相关资源
      最近更新 更多