Use fFileCopy instead of Save to Flash Drive?

J

jimc

I apologize for cross posting to newusers, not sure which was
appropriate

I am new to VBA, I have seen here and on other newsgroups that it is
unwise to save a word file directly to removeable media because of the
various temp files created. Can I use Filecopy on a closed file
instead? My snippet is below. I have used and modified the code from
Graham Mayors site (http://www.gmayor.com/index.htm):

Sub Backup()

Dim strFileA, strFileB, strFileC, strFileD
ActiveDocument.Save
strFileA = ActiveDocument.Name

' backup file to different folder every other day

If Even = (Day(Now) Mod 2) - 1 Then
strFileB = "C:\Documents and Settings\Jim.DELL5150\My
Documents\MyOddBackups\" & Format$(Now, "mmm d") & strFileA
Else
strFileB = "C:\Documents and Settings\Jim.DELL5150\My
Documents\MyEvenBackups\" & Format$(Now, "mmm d") & strFileA
End If

strFileC = ActiveDocument.FullName

ActiveDocument.SaveAs FileName:=strFileB
ActiveDocument.SaveAs FileName:=strFileC

' after closing backup file, copy it to USB flash drive

FileCopy strFileB, "F:\backups.doc"

End Sub
 
R

Russ

Jimc,
I'm sure it's always safe to save a Word doc to any removable media when
finished or incrementally, while editing ( even floppies ).

The write-to-disk to save is generally not a problem.

What you probably should not do is open a Word doc file from floppies and
edit it. It is better to copy or move the file to a hard drive **before
opening it in Word**, because the constant revising that Word does to the
file once opened is more reliable when done on a hard drive. Then save the
finished, edited version back to the floppy.

Constant rewriting is especially a problem with floppies, but USB thumb
drives may be more reliable than even a hard drive since they have more file
space than a floppy and don't use a mechanical operation to read or write a
file.
 
J

jimc

Russ said:
Jimc,
I'm sure it's always safe to save a Word doc to any removable media when
finished or incrementally, while editing ( even floppies ).

The write-to-disk to save is generally not a problem.

What you probably should not do is open a Word doc file from floppies and
edit it. It is better to copy or move the file to a hard drive **before
opening it in Word**, because the constant revising that Word does to the
file once opened is more reliable when done on a hard drive. Then save the
finished, edited version back to the floppy.

Constant rewriting is especially a problem with floppies, but USB thumb
drives may be more reliable than even a hard drive since they have more file
space than a floppy and don't use a mechanical operation to read or write a
file.


Russ,
OK, thats what I thought.

-Saving an open file or and edit to/from removable media is bad
-filecopy a closed copy of an open file to removeable media is OK.

By the way, I check for existance of the Flash drive before writing to
it with Dir()

Thanks
Jim
 
R

Russ

Jimc,
Just to reiterate the distinction:

Word relies on the connection to the original file opened, while the user is
editing. So it would be very bad to eject any removable media while editing
a file from that media.

But as long as you don't eject while editing a file from a USB solid state
thumb drive, then writing to that drive can be even more reliable than a
file from a hard drive since there is no mechanical method employed to write
to that device. So it would be safe to open, edit, and save to the same file
on such a device, like is it is safe on a hard drive.

Floppies and some removable cards that work like floppies with a mechanical
means of recording to a small, magnetic-material-coated disk should not be
used for **editing**, however saving a **finished** file before closing the
file in Word to **any** device(s) is OK.

And finally, backing up data to separate devices is wise thing to do.
 
G

Graham Mayor

No! No! No!

*Never ever* open/save/print directly from Floppy. The problem has nothing
to do with the mechanical nature of the disc or the magnetic recording
material, but the unpredictable way that Word creates temporary files in the
working folder at any time it is open. If there is insufficient space for
the temporary files and the document, then the floppy disc will be corrupted
and the file lost. This is the most common cause of document corruption and
is well documented in this forum and elsewhere.

The problem is less marked with flash drives, but could occur with a well
used flash. Corruption of which will potentially destroy *all* the files it
contains. It is bad practice to save Word documents to removable media of
any type directly. Always copy to and from the hard drive.

Jimc duplicated this post in another forum. Please don't do that. It creates
an unwelcome duplication of effort. However a modified version of his macro
appears, attached to his post in that forum which will do what he wants to
achieve without risking corruption of the media.

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
J

jimc

Thank you Graham.
My apologies to all for the cross post. I recognized that this was in
poor etiqette and apologized at the start of my post. A search led me
to believe that either group may or may not have the answer I was
looking for.
 
G

Graham Mayor

If you wish to post to more than one newsgroup, then put all the groups in
the same 'send-to' line separated by commas. This links the messages and
minimizes duplication of effort by those who respond to questions.
See also http://www.gmayor.com/MSNews.htm
--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 

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