Goal: 'To modify the code to extract input file path from one cell and the output file path from a different cell'
Assuming the INPUT PATH value is in A1 in this format: "C:\Users\Username\Documents\Myfolder1\"
where Myfolder1 is where the files reside that you want to convert to xlsx,
INPath = cells(1,"A")
and Assuming the OUTPUT PATH value is in B2 in this format: "C:\Users\Username\Documents\Myfolder2\"
OUTPath = cells(2,"B")
NOTE: The INPUT and OUTPUT paths must both end with a backwards slash, "\".
Code:
Sub RenameXLSMtoXLSX()
'Makes a copy in xlsx format (smaller file size) then deletes the xlsm file if you want to...see below
Dim Files As String, LRow As Integer
Dim INPath, OUTPath As String
INPath = Cells(1, "A") 'cell A1 value similar to: C:\Users\Username\Documents\Myfolder1\
Files = Dir(INPath & "*.xlsm")
OUTPath = Cells(2, "B") 'cell B1 value similar to: C:\Users\Username\Documents\Myfolder2\
Application.ScreenUpdating = False
Do While Files <> ""
Application.DisplayAlerts = False
Workbooks.Open Filename:=INPath & Files
ActiveWorkbook.SaveAs Filename:=OUTPath & Left(Files, InStrRev(Files, ".")) & "xlsx", FileFormat:=xlOpenXMLWorkbook
SetAttr INPath & Files, vbNormal
ActiveWorkbook.Close SaveChanges:=False
'Kill INPath & Files 'Uncomment this line if you want to delete the xlsm files
Files = Dir
Loop
Application.ScreenUpdating = True
End Sub
Let me know how you make out.
Perpa