Hello,
I'm really new when it comes to excel, and are really just trying to piece together strings from different forums alongside trying to learn.
I'm trying to Save a Copy as a CSV file, without the need of choosing a file-name or path - I really just want the file to appear in the correct folder, with the name, a custom stamp, and date.
Something like this: "name"_"insert_string"_ddmmyyyy
Also, I want the original ws to close without saving after completion - right now its returning a blank excel form that I have to close manually.
This is what I've gotten thus far - I've snatched most of it from an answer Mr. John_W made to a post some while ago
Anyone got any ideas?
Much appreciated,
Kasper C
I'm really new when it comes to excel, and are really just trying to piece together strings from different forums alongside trying to learn.
I'm trying to Save a Copy as a CSV file, without the need of choosing a file-name or path - I really just want the file to appear in the correct folder, with the name, a custom stamp, and date.
Something like this: "name"_"insert_string"_ddmmyyyy
Also, I want the original ws to close without saving after completion - right now its returning a blank excel form that I have to close manually.
This is what I've gotten thus far - I've snatched most of it from an answer Mr. John_W made to a post some while ago
VBA Code:
Dim folderPath As String
Dim csvFile As String
Dim dto As String, name As String, insert_string As String
name = "name"
dto = Format(CStr(Now), "ddmmyyyy")
insert_string = InputBox("Prompt")
folderPath = "\path"
csvFile = Application.GetSaveAsFilename(InitialFileName:=folderPath, _
FileFilter:="CSV (semikolondelt) (*.csv), *.csv", Title:="Save As CSV")
If csvFile <> "" And csvFile <> "False" Then
Application.ScreenUpdating = False
ActiveSheet.Copy
On Error Resume Next
ActiveWorkbook.SaveAs Filename:=csvFile, FileFormat:=xlCSV, Local:=True, _
Password:="", WriteResPassword:="", ReadOnlyRecommended:=False, CreateBackup:=False, ConflictResolution:=xlUserResolution
On Error GoTo 0
ActiveWorkbook.Close SaveChanges:=False
Application.ScreenUpdating = True
End If
ActiveWorkbook.Close SaveChanges:=False
Anyone got any ideas?
Much appreciated,
Kasper C