找回密码
 加入
搜索
查看: 1159|回复: 2

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

[复制链接]
发表于 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里没有内容进去,数组内是有东西的!
发表于 2009-3-10 15:31:48 | 显示全部楼层
没用AU3玩过EXCEL 都是用VBS玩的 晚上回家研究一下
发表于 2009-3-10 16:08:06 | 显示全部楼层
数组内有数据,那就是写文件那有问题了
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-9-23 07:18 , Processed in 0.076392 second(s), 24 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表