没看你的vba。反正这个很简单,就随便给你写了个,,debug什么都没做,细节请自行补上#include <Array.au3>
#include <File.au3>
#include <MsgBoxConstants.au3>
#include <Excel.au3>
Local $aFileList = _FileListToArray(@ScriptDir, "*.xlsx")
Local $oWorkbook
_ArrayDisplay($aFileList, "$aFileList")
Local $oExcel = _Excel_Open();静默替换,这里参数设为0或者FALSE
If @error Then Exit MsgBox(16, "", "EXCEL对象创建失败.")
For $i = 1 To $aFileList[0]
$oWorkbook = _Excel_BookOpen($oExcel, @ScriptDir & "" & $aFileList[$i])
If @error Then MsgBox($MB_SYSTEMMODAL, "", $aFileList[$i] & "文件打开失败 ")
_Excel_RangeReplace($oWorkbook, Default, Default, "工具", "yamakawa的杰作")
;第三个参数你要替换的字符串
;第四个参数,替换后的文件
Sleep(1000)
_Excel_BookClose($oWorkbook)
Next
_Excel_Close($oExcel)
MsgBox(0,"","替换完成,请自行检查!")
|