redsun083 发表于 2009-3-10 15:29:40

请问下高手我的代码是不是有什么问题,

#include <Excel.au3>
#include <Array.au3>
#include <File.au3>
$sFilePath1 = "D:\chenyuanlong\桌面\test\contacts.xls" ;This file should already exist
$oExcel = _ExcelBookOpen($sFilePath1)
$sFile = "D:\Test.txt"
;Show any errors that might occur when Opening the File
If @error = 1 Then
    MsgBox(0, "Error!", "Unable to Create the Excel Object")
    Exit
ElseIf @error = 2 Then
    MsgBox(0, "Error!", "File does not exist - Shame on you!")
    Exit
EndIf
$aArray = _ExcelReadSheetToArray($oExcel) ;Using Default Parameters
;将EXCEL文件读到数组
_FileWriteFromArray($sFile, $aArray, 0)
; 将数组内容写入TEST.TXT文件
_ArrayDisplay($aArray, "Array using Default Parameters")
;显示下数组内容
FileClose($sFile)
; Display results
Run("notepad.exe " & $sFile)
_ExcelBookClose($oExcel) ; 关闭打开的XLS文件



现在的问题是TEST.TXT里没有内容进去,数组内是有东西的!

xrbenbeba 发表于 2009-3-10 15:31:48

没用AU3玩过EXCEL 都是用VBS玩的 晚上回家研究一下

liongodmien 发表于 2009-3-10 16:08:06

数组内有数据,那就是写文件那有问题了
页: [1]
查看完整版本: 请问下高手我的代码是不是有什么问题,