我正在运行这个脚本,但在 Targetfolder 中什么也没有出现,没有文件。有想法该怎么解决这个吗?
感谢您的时间!
Dim xlApp, xlWkb, SourceFolder, TargetFolder, file
Set xlApp = CreateObject("excel.application")
Set fs = CreateObject("Scripting.FileSystemObject")
Const xlNormal = 1
SourceFolder = "c:\temp\XMLfiles"
TargetFolder = "c:\temp\XLSfiles"
'Hide Excel
xlApp.Visible = False
'Process each file in SourceFolder
For Each file In fs.GetFolder(SourceFolder).Files
'Open file in SourceFolder
Set xlWkb = xlApp.Workbooks.Open(file)
'Get Filename
BaseName = fs.getbasename(file)
'Concatenate full path. Extension will be automatically added by Excel
FullTargetPath = TargetFolder & "\" & BaseName
'Save as XLS file into TargetFolder
xlWkb.SaveAs FullTargetPath, xlNormal
'Close file
xlWkb.Close
Next
Set xlWkb = Nothing
Set xlApp = Nothing
Set fs = Nothing
MsgBox "Finished. Have a nice day!"