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 / January 2006

Tip: Looking for answers? Try searching our database.

Saving a document in multiple locations at one time.

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
FC - 13 Jan 2006 14:16 GMT
I would like to be able to save a single document in multiple folders at one
time. So I guess that means all these folders must be linked.
Thanks
Kevin B - 13 Jan 2006 14:51 GMT
The folder do not have to be linked, you just need to loop through all the
paths you want to save to.  The code below saves a file to 4 different
directories:

Sub MultiSave()

   Dim doc As Document
   Dim strFolder1 As String
   Dim strFolder2 As String
   Dim strFolder3 As String
   Dim strFolder4 As String
   Dim varArray As Variant
   Dim varFolders As Variant
   
   Set doc = ActiveDocument
   strFolder1 = "d:\FullPath1"
   strFolder2 = "d:\FullPath2"
   strFolder3 = "d:\FullPath3"
   strFolder4 = "d:\FullPath4"

   varArray = Array(strFolder1, strFolder2, strFolder3, strFolder4)
   varFolders = varArray
   
   Application.DisplayAlerts = wdAlertsNone
   
   For Each varFolders In varArray
       doc.SaveAs varFolders & "\" & "DocumentName.doc"
   Next varFolders

   Application.DisplayAlerts = wdAlertsAll
   Set doc = Nothing

Signature

Kevin Backmann

> I would like to be able to save a single document in multiple folders at one
> time. So I guess that means all these folders must be linked.
>  Thanks
FC - 13 Jan 2006 15:05 GMT
Thanks for the reply,
I am new to programming and so I am not sure where I should write this
routine in . Your help is appreciated.
Fc

> The folder do not have to be linked, you just need to loop through all the
> paths you want to save to.  The code below saves a file to 4 different
[quoted text clipped - 31 lines]
> > time. So I guess that means all these folders must be linked.
> >  Thanks
Kevin B - 13 Jan 2006 15:22 GMT
Access the Visual Basic editor using any of the following methods:

1.  Press Alt+F11
2.  Click Tools in the menu, Macro from the drop-down menu and VB Editor
3.  Right click on any toolbar, select the VB toolbar and click the VB
editor button

Once you're in the editor click Insert and select module, and this is where  
you would enter in any code.

FYI:  In my prior post I neglected to copy the End Sub line, which should be
the last line in the macro.

You can copy the code out of the post and substitute the correct paths and
filename if you want to test drive the code.  To execute the code from the
Editor press F5, or to run the code 1 line at a time press F8, once for each
line of code in the sub.

Signature

Kevin Backmann

> Thanks for the reply,
>  I am new to programming and so I am not sure where I should write this
[quoted text clipped - 36 lines]
> > > time. So I guess that means all these folders must be linked.
> > >  Thanks
 
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.