Trisha Sarkar
New Member
- Joined
- May 18, 2021
- Messages
- 4
- Office Version
- 365
- 2016
- Platform
- Windows
Hi,
I am trying the below VBA to convert almost 40 files in a folder on my desktop from .xlsm format to .xlsx format.
I want the .xlsx files on the same folder I have the macro files and then also delete the .xlsm files using the same VBA. But, i am getting compline error while running this macro. Please can someone help me.
Sub RenameXLSMtoXLSX()
Dim Files As String, LRow As Integer
Files = Dir("U:\Desktop\Stats compile\*.xlsm")
MyPath = "<U:\Desktop\Stats compile\*.xlsm>"
Application.ScreenUpdating = False
Do While Files <> ""
Application.DisplayAlerts = False
Workbooks.Open Filename:=MyPath & Files
ActiveWorkbook.SaveAs Filename:=MyPath & Left(Files, InStrRev(Files, ".")) & "xlsx", FileFormat:=xlOpenXMLWorkbook
SetAttr MyPath & Files, vbNormal
ActiveWorkbook.Close SaveChanges:=False
Files = Dir
Loop
Application.ScreenUpdating = True
End Sub
I am trying the below VBA to convert almost 40 files in a folder on my desktop from .xlsm format to .xlsx format.
I want the .xlsx files on the same folder I have the macro files and then also delete the .xlsm files using the same VBA. But, i am getting compline error while running this macro. Please can someone help me.
Sub RenameXLSMtoXLSX()
Dim Files As String, LRow As Integer
Files = Dir("U:\Desktop\Stats compile\*.xlsm")
MyPath = "<U:\Desktop\Stats compile\*.xlsm>"
Application.ScreenUpdating = False
Do While Files <> ""
Application.DisplayAlerts = False
Workbooks.Open Filename:=MyPath & Files
ActiveWorkbook.SaveAs Filename:=MyPath & Left(Files, InStrRev(Files, ".")) & "xlsx", FileFormat:=xlOpenXMLWorkbook
SetAttr MyPath & Files, vbNormal
ActiveWorkbook.Close SaveChanges:=False
Files = Dir
Loop
Application.ScreenUpdating = True
End Sub