回复 1# blue_dvd
新版照样可以直接写入数组啊!
#include <Array.au3>
#include <Excel.au3>
#include <MsgBoxConstants.au3>
; 创建应用程序对象并创建一个新工作簿
Local $oAppl = _Excel_Open()
If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_RangeWrite 示例", "创建 Excel 应用对象发生错误." & @CRLF & "@error = " & @error & ", @extended = " & @extended)
Local $oWorkbook = _Excel_BookNew($oAppl)
If @error Then
MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_RangeWrite 示例", "创建新工作簿失败." & @CRLF & "@error = " & @error & ", @extended = " & @extended)
_Excel_Close($oAppl)
Exit
EndIf
; *****************************************************************************
; 2D 数组元素写入活动工作簿的活动工作表
; *****************************************************************************
Local $aArray2D[3][5] = [[11, 12, 13, 14, 15],[21, 22, 23, 24, 25],[31, 32, 33, 34, 35]]
_Excel_RangeWrite($oWorkbook, $oWorkbook.Activesheet, $aArray2D, "B1")
If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_RangeWrite 示例 3", "写入工作表失败." & @CRLF & "@error = " & @error & ", @extended = " & @extended)
MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_RangeWrite 示例 3", "2D 数组成功写入.")
|