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 / October 2005

Tip: Looking for answers? Try searching our database.

Setting a Path in Word VBA

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
paulinec - 29 Oct 2005 05:55 GMT
I  found the following macro on the internet (from someone else's
question)and it is working for me, except that it is saving the documents all
to my C drive.
How can I program a path eg.  C:\A_Data\Word\Merge
   
   Dim x               As Long
   Dim Sections        As Long
   Dim Doc             As Document
       
   Application.ScreenUpdating = False
   Application.DisplayAlerts = False
   
   Set Doc = ActiveDocument
         
   Sections = Doc.Sections.Count
   For x = Sections - 1 To 1 Step -1
       Doc.Sections(x).Range.Copy
       Documents.Add
       ActiveDocument.Range.Paste
       ActiveDocument.SaveAs (Doc.Path & "\" & x & ".doc")
       ActiveDocument.Close False
   Next x
   
   Application.ScreenUpdating = True
   Application.DisplayAlerts = True
   
End Sub
Hoping someone can help me with this.
Signature

PaulineC

macropod - 29 Oct 2005 08:34 GMT
Hi Pauline,

Simply change the 'Doc.Path' reference to your preferred path. So, instead
of:
ActiveDocument.SaveAs (Doc.Path & "\" & x & ".doc")
use:
ActiveDocument.SaveAs ("C:\A_Data\Word\Merge" & "\" & x & ".doc")

Cheers

> I  found the following macro on the internet (from someone else's
> question)and it is working for me, except that it is saving the documents all
[quoted text clipped - 24 lines]
> End Sub
> Hoping someone can help me with this.

Rate this thread:






 
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.