CSV dump

R

rjre

I would like a workbook to dump a particular sheet every few minutes
to a CSV file. The sheet itself doesn't contain a large amount of data
(maybe 30 columns by 200 rows) - but we need to be able to show/
reconcile what was on the sheet at a particular time/date.

Do you guys out there have any suggestions for the most unobtrusive
way to do this? ie: performing a File->Save AS function ties up the
app for a few seconds.

thank you very much

richard
 
D

Dave Peterson

I would add a button from the Forms Toolbar and assign it a macro that does all
the work:

Option Explicit
Sub testme()
Dim wks As Worksheet
Dim WksToSave As Worksheet

Set wks = ActiveSheet
wks.Copy 'to a new workbook

With ActiveSheet
'just overwrite the .csv file, don't give me a warning
Application.DisplayAlerts = False
.Parent.SaveAs _
Filename:="C:\" & Format(Now, "yyyymmdd_hhmmss") & ".csv", _
FileFormat:=xlCSV
Application.DisplayAlerts = True
.Parent.Close savechanges:=False
End With

End Sub

It's the equivalent of copying the activesheet to a new workbook and saving that
new workbook as a .csv file.

Change the path (it has to exist!) to what you want.
 
R

rjre

can i force it into the background...as i do not want any pause in
being able to work on the active workbook?

thx
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top