I have written code to create a csv file, but the sheet name must the same as sheet1 on the xlsm file from whch it was created
Code:
Sub CreateCSVFile()
Dim MyPath As String
Dim MyFileName As String
'The path and file names:
MyPath = "C:\Journal Templates\"
MyFileName = "Adjustment JNL.csv"
If Not Right(MyPath, 1) = "\" Then MyPath = MyPath & "\"
With ActiveWorkbook
.Sheets(1).Name = "JNL"
.SaveAs Filename:= _
MyPath & MyFileName, _
FileFormat:=xlCSV, _
CreateBackup:=False
.Close False
End With
End Sub
Kindly amend my code to meet the above requirement
Bookmarks