Sub cmdSave()
Dim sFileName As String
Dim WB As Workbook
Dim LastRow As Long
Application.DisplayAlerts = False
sFileName = "Testing.csv"
'Copy the contents of required sheet ready to paste into the new CSV
Sheets(1).Range("A1").CurrentRegion.Copy 'Define your own range if required
'Open a new XLS workbook, save it as the file name
Set WB = Workbooks.Add
With WB
.Title = "MyTitle"
.Subject = "MySubject"
.Sheets(1).Select
ActiveSheet.Paste
.Saveas "D:\Downloads\Excel" & sFileName, xlCSV
.Close
End With
Application.DisplayAlerts = True
End Sub
I have changed the location and the filename still it is not saving the file
Bookmarks