Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / November 2006

Tip: Looking for answers? Try searching our database.

Save Document To Two Locations With Single Save

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
HLD920 - 03 Nov 2006 21:00 GMT
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.
Jean-Guy Marcil - 04 Nov 2006 05:48 GMT
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
[quoted text clipped - 15 lines]
> Anybody's help would be appreciated on how to get this issue
> resolved. Thank you very much.

What code are you using?

Signature

Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
jmarcilREMOVE@CAPSsympatico.caTHISTOO
Word MVP site: http://www.word.mvps.org

Graham Mayor - 04 Nov 2006 07:43 GMT
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

Signature

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

My web site www.gmayor.com
Word MVP web site http://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>

> 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
[quoted text clipped - 15 lines]
> Anybody's help would be appreciated on how to get this issue
> resolved. Thank you very much.
HLD920 - 06 Nov 2006 14:01 GMT
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!

> 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.
[quoted text clipped - 27 lines]
> > Anybody's help would be appreciated on how to get this issue
> > resolved. Thank you very much.
mwoodward@grandecom.net - 20 Nov 2006 17:40 GMT
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
Graham Mayor - 21 Nov 2006 05:51 GMT
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.

Signature

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

My web site www.gmayor.com
Word MVP web site http://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>

> 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
[quoted text clipped - 11 lines]
>
> Matt
mwoodward@grandecom.net - 22 Nov 2006 03:11 GMT
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
Graham Mayor - 22 Nov 2006 07:38 GMT
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

> 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
[quoted text clipped - 8 lines]
>
> Matt
mwoodward@grandecom.net - 28 Nov 2006 01:03 GMT
Graham, this appears to have done the trick.  I sure appreciate your
helpfulness in providing this information.  Thanks very much.

Matt
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.