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 / Page Layout / February 2004

Tip: Looking for answers? Try searching our database.

separate chapters

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
hippo - 24 Feb 2004 06:06 GMT
hi al

I have documents which consist of following parts: coverpage, contents, chap1, chap 2.... chap n. Now i want to save each part to different .txt file. How should I do it

The hard thing for me is that there is no standard format style for them... What I mean is the outline numberred different for each documents.
Doug Robbins - Word MVP - DELETE UPPERCASE CHARACTERS FROM EMAIL ADDRESS - 24 Feb 2004 10:09 GMT
If each part is in a separate Section, you could use something like:

Sub splitter()

' splitter Macro

' Macro created by Doug Robbins to save each letter created by a mailmerge
as a separate file.

Dim Letters As Integer, Counter As Integer
Letters = ActiveDocument.Sections.Count
Selection.HomeKey Unit:=wdStory
Counter = 1
While Counter < Letters
   DocName = "Myletter" & LTrim$(Str$(Counter))
   ActiveDocument.Sections.First.Range.Cut
   Documents.Add
   Selection.Paste
   ActiveDocument.Sections(2).PageSetup.SectionStart = wdSectionContinuous
   ActiveDocument.SaveAs FileName:=DocName, FileFormat:= _
       wdFormatDocument, LockComments:=False, Password:="",
AddToRecentFiles:= _
       True, WritePassword:="", ReadOnlyRecommended:=False,
EmbedTrueTypeFonts:= _
       False, SaveNativePictureFormat:=False, SaveFormsData:=False, _
       SaveAsAOCELetter:=False
   ActiveWindow.Close
   Counter = Counter + 1
Wend

End Sub

Signature

Please post any further questions or followup to the newsgroups for the
benefit of others who may be interested.  Unsolicited questions forwarded
directly to me will only be answered on a paid consulting basis.
Hope this helps
Doug Robbins - Word MVP

> hi all
>
[quoted text clipped - 4 lines]
> The hard thing for me is that there is no standard format style for
> them... What I mean is the outline numberred different for each documents.
hippo - 25 Feb 2004 06:11 GMT
The point is all the chapters are in one sections. So actually i am unable to differentiate the chapters. ANyway, i am coding in VC. Hence, dun really know if any difference about sections in VB or no

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.