Discussion Locked

export xls to csv

0 helpful
2 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

Hi,

I'm looking for a macro in excel that lets me export to csv.
The filename must be the name of the sheet combined with the month and year on the moment of export.
Can somebody help me out? I've been searching for a few hours but no luck so far.

Kind regards,
PM.

2 replies

by rkuhn040172

Might take a bit tweaking like where you want to save the file (I used the desktop of my profile) and the time/date format (I just used dd-mm-yyyy) but that's your basic code.

Sub Macro1()
'
' Macro1 Macro
' Macro recorded 5/2/2006 by rickk
'
' Keyboard Shortcut: Ctrl+p
'
ChDir "C:\Documents and Settings\rickk\Desktop"
ActiveWorkbook.SaveAs Filename:="C:\Documents and Settings\rickk\Desktop\" & ActiveSheet.Name & " " & Format(Date, "dd-mm-yyyy"), _
FileFormat:=xlCSV, CreateBackup:=False
End Sub

This discussion is closed to new replies.