本帖最后由 mid_w 于 2015-9-26 22:35 编辑
我建立了一个excel,18.xlsx,在A1单元格录入了一个时间。用下面的代码为何不能显示出excel一个单元格值的字符串?请高手指教。#include <Excel.au3>
#include <MsgBoxConstants.au3>
Local $oAppl = _Excel_Open()
Local $oWorkbook1 = _Excel_BookOpen($oAppl, @DesktopDir & "\18.xlsx", True)
Local $sEvalString = Eval($oWorkbook1.ActiveSheet.Range("A1"))
MsgBox($MB_SYSTEMMODAL, "", $sEvalString)
WinClose("Microsoft Excel")
正确代码如下 :#include <Excel.au3>
#include <MsgBoxConstants.au3>
Local $oAppl = _Excel_Open()
Local $oWorkbook1 = _Excel_BookOpen($oAppl, @DesktopDir & "\18.xlsx", True)
Local $sCellValue = _Excel_RangeRead($oWorkbook1,Default,"A1")
MsgBox($MB_SYSTEMMODAL, "", $sCellValue)
WinClose("Microsoft Excel")
|