backup file
Patrick,
Here's the code that creates the backup file, date2string creates a time
stamp in the form of 082409_1030 so that the time that macro started running
is recorded.
Rem
Rem Creating back up text file for emergencies
Rem
fino = FreeFile
Dim bu As String
Call date2string(bu)
Open "backup_" & bu & ".txt" For Output As #fino
Here's the code that actually writes the data:
Rem
Rem writing backup data to a text file in case there's a mistake made
Rem
Dim textline As String
textline = ""
textline = EntryNo & ";" & lblTime.Caption & ";" & cbSource.Text & ";" &
cbDirection.Text & ";" & tbComments.Text
Write #fino, textline
"Patrick Molloy" wrote:
My preference would be as you do, to dump the data to a text file so that it
can be retrieved later, This should be faster than saving Excel tiself.
Show us your code.
"David Gerstman" wrote:
I created a macro for capturing data and recording it.
The person who asked for this macro also wanted me to keep a back up file in
case of a power loss or carelessness on part of the operator.
I wrote code for creating a parallel text file. The problem is that when I
use the Task Manager to shut down Excel (to mimic the effect of a power
outage) the text file is created but no data is recorded in it. I've created
text files both for output and for append and neither one writes to the file.
Is there a way to record the data? Or am I better off just saving the
spreadsheet after each new entry?
|