ashish mehra
Active Member
Hi all,
I have a list of files saved on desktop in a specific folder in .csv & .xls format. I want to change the name & format to .xlsx
I try with following code:
Regards,
AM
I have a list of files saved on desktop in a specific folder in .csv & .xls format. I want to change the name & format to .xlsx
I try with following code:
Code:
Sub TEST()
Dim wbCounter As Integer
Dim wbPath As String
Dim newFileName As String
Dim myPath As String
Dim newfilenamewithoutext As String
myPath = "C:\Ashish\"
With Application.FileDialog(msoFileDialogOpen)
.AllowMultiSelect = True
.Title = "Select Files to be renamed"
.Show
wbCounter = .SelectedItems.Count
For i = 1 To wbCounter
wbPath = .SelectedItems(i)
Workbooks.Open (wbPath)
newFileName = ActiveWorkbook.Name
ActiveWorkbook.SaveAs Filename:= _
myPath & "newfilenamewithoutext" & ".xlsx", FileFormat:= _
xlOpenXMLWorkbook, CreateBackup:=False
ActiveWindow.Close
Next i
End With
End Sub
Regards,
AM