- Set fso = CreateObject("Scripting.FileSystemObject")
- Set xlsApp = CreateObject("Excel.Application")
- Set Folder = fso.GetFolder(".")
- For Each File In Folder.Files
- If LCase(Right(File.Path, 3)) = "xls" Then
- Repxls File.Path
- End If
- Next
- xlsApp.Quit
- msgbox "Done"
-
- Function Repxls(file)
- Set objBook = xlsapp.Workbooks.Open(file)
- For i=1 To objBook.sheets.count
- If objBook.sheets(i).UsedRange.count > 1 Then
- For Each cell In objBook.sheets(i).UsedRange
- If cell.value = "" Then cell.value = 0
- Next
- End If
- Next
- objBook.Save
- objBook.Close
- Set objBook=Nothing
- End Function
复制代码
|