Quantcast
Channel: Excel Help Forum - Excel Programming / VBA / Macros
Viewing all articles
Browse latest Browse all 50151

filename suggestion for tab to CSV export

$
0
0
I'm trying to copy a single sheet named "AuditFile" to a new CSV file. I'm almost there but I would like to have the new CSV suggest a filename that I specify in a cell named "auditFile". I've looked around, but can't seem to find how to suggest a filename, and still allow the user to select the folder to save it in. Is this possible?

Code:

Sub ConvertCSV()

Dim strFileName As String

strFileName = Application.GetSaveAsFilename(filefilter:="Comma Seperated Values (*.csv), *.csv")

If strFileName <> "False" Then
    Sheets("AuditFile").Copy
    ActiveWorkbook.SaveAs strFileName, xlCSV
End If

End Sub


Viewing all articles
Browse latest Browse all 50151