Save Document To Two Locations With Single Save

H

HLD920

I have attempted to create a macro that is described in Graham Mayor's
instructions. However, once I have the macro saved, by following those
instructions, it looks as if the macro works great. When I close Word down
and attempt to reopen the document, or any other Word document, Word gives me
the following error message:
Microsoft Word has encountered a problem and needs to close. We are sorry
for the inconvenience. The information you were working on might be lost.
Microsoft Word can try to recover it for you.

There is a check box next to "Recover my work and restart Microsoft Word"
that is checked. If I un-check it and click on the "Don't Send" button I am
able to get out of the application. The only way that I found that I can open
Microsoft Word is if I go into my Templates folder in Application Data and
delete the Normal.dot file. (Which I am sure is not the right thing to do!)
This will enable me to open up the Word document that I was working on.

Anybody's help would be appreciated on how to get this issue resolved. Thank
you very much.
 
J

Jean-Guy Marcil

HLD920 was telling us:
HLD920 nous racontait que :
I have attempted to create a macro that is described in Graham Mayor's
instructions. However, once I have the macro saved, by following those
instructions, it looks as if the macro works great. When I close Word
down and attempt to reopen the document, or any other Word document,
Word gives me the following error message:
Microsoft Word has encountered a problem and needs to close. We are
sorry for the inconvenience. The information you were working on
might be lost. Microsoft Word can try to recover it for you.

There is a check box next to "Recover my work and restart Microsoft
Word" that is checked. If I un-check it and click on the "Don't Send"
button I am able to get out of the application. The only way that I
found that I can open Microsoft Word is if I go into my Templates
folder in Application Data and delete the Normal.dot file. (Which I
am sure is not the right thing to do!) This will enable me to open up
the Word document that I was working on.

Anybody's help would be appreciated on how to get this issue
resolved. Thank you very much.

What code are you using?

--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
(e-mail address removed)
Word MVP site: http://www.word.mvps.org
 
G

Graham Mayor

There is nothing in the macro that will cause this behaviour, but once Word
crashes it leaves a raft of temporary files which make things worse.
Deleting normal.dot is not the issue, but deleting its lock file - see
http://www.gmayor.com/what_to_do_when_word_crashes.htm

I assume that the backup location you are saving to exists on the PC and
that you are not saving the duplicate to removable media as warned against
on the web page? http://www.gmayor.com/automatically_backup.htm

If the problem persists - see
http://word.mvps.org/FAQs/AppErrors/ProbsOpeningWord.htm

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


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
H

HLD920

I will try this. Thanks. The backup location is actually a network location
that I would like to put the backups to in case something happens with my PC.
I will reply if the instructions you provided help. Thanks again!
 
M

mwoodward

Graham, I am using your macro and it's great! One question. I save to
my hard drive and use your macro to also save to a folder on the
network. I noticed that it will store the document as a separate
document that has the same name as the original that is stored there.
In other words, I open a document on the hard drive, let's call it File
1. I have already stored it on the network previously. When I open
File 1 from my hard drive and work on it, when I use the macro, it will
save File 1 as a separate document than the File 1 that already exists
in the network folder. So then there are two File 1 documents, but
only one has the recent edit. Is there any way to amend the macro so
that it will save it as the original file if it already exists? Thanks
so much.

Matt
 
G

Graham Mayor

The macro simply saves the documents in two locations. However the second
location has "Backup " in front of the filename. If you want it to overwrite
an existing file remove the "Backup " text from the line

strFileB = "D:\My Documents\Word Backup\Backup " & strFileA
ie
strFileB = "D:\My Documents\Word Backup\" & strFileA

"D:\My Documents\Word Backup\" being your network location.

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


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
M

mwoodward

Graham, thanks for the reply. I have already removed the "backup" text
from the line so that the file would have the same name as the files
that already exist on my hard drive. I copied all of the files from my
hard drive to the network folder, but if I open one from the hard drive
and then save it using the macro, it will save that file as a new one
on the network with the same name as the original that already exists.
I might be confusing things so I will say it a different way. Is there
a way to alter the macro so that it will check to see if that filename
already exists, and then will replace it with the modified one?
Thanks.

Matt
 
G

Graham Mayor

What I think you want is a warning if the backup file already exists?
The following will do that - once!
Change strPathB to your backup location

Sub SaveToTwoLocationsB()
Dim strFileA, strFileB, strPathA, strPathB, fso

ActiveDocument.Save
strPathA = ActiveDocument.Path
strFileA = ActiveDocument.Name
strPathB = "D:\My Documents\Test\Merge\"
ChangeFileOpenDirectory strPathB

Set fso = CreateObject("Scripting.FileSystemObject")
If Not fso.FileExists(strFileA) Then
ActiveDocument.SaveAs FileName:=strFileA
Else
strFileB = InputBox(strFileA & _
" already exists in the backup location. Rename?", , strFileA)
ActiveDocument.SaveAs FileName:=strFileB
End If

ChangeFileOpenDirectory strPathA
ActiveDocument.SaveAs FileName:=strFileA
End Sub
 
M

mwoodward

Graham, this appears to have done the trick. I sure appreciate your
helpfulness in providing this information. Thanks very much.

Matt
 

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