|
如题
代码如下
- Sub 批量转化为XLSX()
- MyFile111 = ActiveWorkbook.Name
- Dim FilePath, MyFile, iPath, Name, OutPath As String
- iPath = Workbooks(MyFile111).Path
- OutPath = Dir(iPath & "\xlsx", vbDirectory)
- If OutPath = "" Then
- MkDir (iPath & "\xlsx")
- End If
- MyFile = Dir(iPath & "\*.xls")
- If MyFile <> "" Then
- Do
- On Error Resume Next
- If MyFile = Workbooks(MyFile111).Name Then MyFile = Dir
- Set aa = Workbooks.Open(Filename:=iPath & "" & MyFile, UpdateLinks:=0)
- MyFile = Replace(MyFile, ".xls", ".xlsx")
- Name = "" & MyFile
- FilePath = iPath & "\xlsx" & Name
- Application.ScreenUpdating = False
- ActiveWorkbook.SaveAs Filename:=FilePath, FileFormat:=xlOpenXMLWorkbook, CreateBackup:=False
-
- Workbooks(MyFile).Close True
-
- Application.ScreenUpdating = True
- MyFile = Dir
- Loop While MyFile <> ""
- End If
- End Sub
复制代码
|
|