separate chapters

H

hippo

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.
 
D

Doug Robbins - Word MVP - DELETE UPPERCASE CHARACT

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

--
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
 
H

hippo

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
 
Top