Created
March 29, 2024 09:09
-
-
Save ZenLiuCN/a43e21c4fb2965faba7cf0c53b970aa5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Dim iFile(1 To 100000) As String | |
Dim count As Integer | |
Sub xls2xlsx() | |
iPath = "D:\Dev\project\jvm\pharmacy\Ã×ÄÚÍøÅÅÃû\" | |
On Error Resume Next | |
count = 0 | |
zdir iPath | |
For i = 1 To count | |
If iFile(i) Like "*.xls" And iFile(i) <> ThisWorkbook.FullName Then | |
MyFile = iFile(i) | |
FilePath = Replace(MyFile, ".xls", ".xlsx") | |
If Dir(FilePath, 16) = Empty Then | |
Set WBookOther = Workbooks.Open(MyFile) | |
Application.ScreenUpdating = False | |
ActiveWorkbook.SaveAs Filename:=FilePath, FileFormat:=xlOpenXMLWorkbook, CreateBackup:=False | |
WBookOther.Close SaveChanges:=False | |
Application.ScreenUpdating = True | |
End If | |
kill(MyFile) | |
End If | |
Next | |
End Sub | |
Sub zdir(p) | |
Set fs = CreateObject("scripting.filesystemobject") | |
For Each f In fs.GetFolder(p).Files | |
If f <> ThisWorkbook.FullName Then count = count + 1: iFile(count) = f | |
Next | |
For Each m In fs.GetFolder(p).SubFolders | |
zdir m | |
Next | |
End Sub |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment