View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson[_3_] Dave Peterson[_3_] is offline
external usenet poster
 
Posts: 2,824
Default Autosave of xls files in csv format with macro

You can copy the activesheet to a new workbook, save that as .csv, close it and
continue what you're doing.

activesheet.copy
activeworkbook.saveas (your csv stuff here)
(activeworkbook is the newly copied worksheet's workbook)
activeworkbook.close savechanges:=false



marian wrote:

I'm having a problem to get this working:
I have an excel loaded with macros and need to save data only in csv
file with datestamp periodically. When I do my first save with code

ActiveWorkbook.SaveAs Filename:=fname, _
FileFormat:=xlCSV, CreateBackup:=False

where fname
fname = "c:\" & "mftst" & Format(Now, "yyyy-mm-dd-hh") & ".csv"
After 1st save, the whole spreadheet changes name to fname (which is
csv) and I get error from macro
How Do I keep original xls file name, and just save copy of the
spreadsheet every hour in csv?
I see that ActiveWorkbook.SaveCopyAs doesn't give option to save in
csv format

tks
marian


--

Dave Peterson