0
我嘗試將保存在personl.xls中的VBA宏應用於給定目錄中的所有文件,但是我在第29行中遇到錯誤.. 恐怕我在這裏弄到了一些東西:VBS將Excel VBA宏應用於當前目錄中的所有文件
Option Explicit
On Error Resume Next
Dim xlApp
Dim xlBook
Dim No_Of_Files
Dim i
Dim File_Path
Set xlApp = CreateObject("Excel.Application")
xlApp.DisplayAlerts = True
File_Path = "C:\Dokumente und Einstellungen\kcichini\Eigene Dateien\Stuff\Test\"
With xlApp.FileSearch
.NewSearch
.LookIn = File_Path
.Filename = "*.xls"
.SearchSubFolders = False
.Execute
No_Of_Files = .FoundFiles.Count
For i = 1 To No_Of_Files
Set xlBook = xlApp.Workbooks.Open(.FoundFiles(i), 0, False)
xlApp.Run "'C:\Dokumente und Einstellungen\kcichini\Anwendungsdaten\Microsoft\Excel\XLSTART\PERSONL.XLS'!SASXLSFormat"
xlApp.ActiveWorkbook.Close
Next i
End With
xlApp.Quit
Set xlBook = Nothing
Set xlApp = Nothing
什麼是第29行?那錯誤在說什麼? – jagsler
這是'下一個我'。留言(德語):'Anweisungsende erwartet'(?en:期待命令結束?) – Kay
@Kay - 「Next i」不是VBScript,使用普通的「Next」。 –