[Word] WORD 2007 Extracting Individual docs from a doc withsection breaks

David Grugeon david at grugeon.com.au
Fri Jan 22 18:08:34 CST 2010


But . . . there is no such line in the code you posted.

 

Best Regards

 

David Grugeon

Grugeon Consulting

(07) 3263 7786

 

Original message:

 

From: word-bounces at dcomp.com [mailto:word-bounces at dcomp.com] On Behalf Of
Srinivasulu B
Sent: Saturday, January 23, 2010 2:42 AM
To: DailyWordTips
Subject: Re: [Word] WORD 2007 Extracting Individual docs from a doc
withsection breaks

 

I went to debug modenad found that yhe the following line is high-lighted
(yellow colour)

ActiveDocument.Bookmarks("\Section").Range.Copy
seena

----- Original Message ----- 

From: David Grugeon <mailto:david at grugeon.com.au>  

To: 'DailyWordTips' <mailto:word at dcomp.com>  

Sent: Friday, January 22, 2010 5:06 PM

Subject: RE: [Word] WORD 2007 Extracting Individual docs from a doc
withsection breaks

 

Which line was the error on?

 

Best Regards

 

David Grugeon

Grugeon Consulting

(07) 3263 7786

 

Original message:

 

From: word-bounces at dcomp.com [mailto:word-bounces at dcomp.com] On Behalf Of
Srinivasulu B
Sent: Friday, January 22, 2010 7:39 PM
To: DailyWordTips
Subject: [Word] WORD 2007 Extracting Individual docs from a doc with section
breaks

 

Sub Splitter()






    Selection.EndKey Unit:=wdStory






    numlets = Selection.Information(wdActiveEndSectionNumber)






    If numlets > 1 Then numlets = numlets - 1






    Selection.HomeKey Unit:=wdStory






    BaseName = "c:\Let"






    For Counter = 1 To numlets






        DocName = BaseName & Right("000" & LTrim(Str(Counter)), 3)






        ActiveDocument.Sections.First.Range.Cut






        Documents.Add






        Selection.Paste






        Selection.MoveLeft Unit:=wdCharacter, Count:=1






        Selection.Delete Unit:=wdCharacter, Count:=1






        ActiveDocument.SaveAs FileName:=DocName






        ActiveWindow.Close






    Next Counter






End Sub
==============================

 

Using Mailmerge I could create a merged documents.
I was able to get a file with n pages (where n is the number of records in
the data file)
I need a separate doc  file for each record.
WORD 2007 gives pages separated by section brakes.
In Allen’s site I got this macro
But it does not work. I get an error (4605)
Is it possible to “repair” this macro a some macro is available to do this
task.
I want a doc file for each record, after merging.
seena

  _____  

_______________________________________________
Word mailing list
Word at dcomp.com
http://lists.dcomp.com/mailman/listinfo/word

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.dcomp.com/pipermail/word/attachments/20100123/a8046b3a/attachment.html


More information about the Word mailing list