Q for Graham or Doug - Split Merge

J

jerem

Hi Graham and/or Doug,

Graham, I went on to a website you directed me to in a previous question
posted and grabbed the split merge code and pared it down to what you see
below in order to get it to save to a document management system, rather than
a local drive. Works great - one little hitch - is there any chance of being
specific as to what type of Section break it cuts and pastes --
ActiveDocument.Sections.First. Range.Cut -- Any way of saying do the cut at
a Next Section Break not at a Continous Section Break. Looked in
intellisense to see if there was anything which specifies this - no luck.

Why would I want to do this? In the merge letters that I work with there is
a continuous section break at the top of every merge letter because there are
different Left and Right margins for the top of each letter to accommodate
for fitting into a preprinted firm letterhead logo. So, when you run this
merge it splits the top portion of the letter from the bottom portion of the
single page letter. Any remedy to this through looking for a specific type
of section break or through any other means????

Thanks as always for your help, ideas and suggestions.
 
J

jerem

Ooops - here's the code I've used (which is your code without the piece to
save locally):

Selection.EndKey Unit:=wdStory
Letters = Selection.Information(wdActiveEndSectionNumber)
Selection.HomeKey Unit:=wdStory
Counter = 1
While Counter < Letters
Application.ScreenUpdating = True
ActiveDocument.Sections.First.Range.Cut
Documents.Add

'Documents are based on the Normal template

'To use an alternative template follow the link.
With Selection
.Paste
.EndKey Unit:=wdStory
.MoveLeft Unit:=wdCharacter, Count:=1
.Delete Unit:=wdCharacter, Count:=1
End With
Selection.HomeKey Unit:=wdStory
ActiveWindow.Close
Counter = Counter + 1
Application.ScreenUpdating = True
Wend
End Sub
 
J

jerem

Ooops - here's the code I've used (which is your code without the piece to
save locally):

Selection.EndKey Unit:=wdStory
Letters = Selection.Information(wdActiveEndSectionNumber)
Selection.HomeKey Unit:=wdStory
Counter = 1
While Counter < Letters
Application.ScreenUpdating = True
ActiveDocument.Sections.First.Range.Cut
Documents.Add

'Documents are based on the Normal template

'To use an alternative template follow the link.
With Selection
.Paste
.EndKey Unit:=wdStory
.MoveLeft Unit:=wdCharacter, Count:=1
.Delete Unit:=wdCharacter, Count:=1
End With
Selection.HomeKey Unit:=wdStory
ActiveWindow.Close
Counter = Counter + 1
Application.ScreenUpdating = True
Wend
End Sub
 
D

Doug Robbins - Word MVP

Have you seen my response to your initial post?

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
J

jerem

Yes. I did. Sorry it took so long to get back to you. It did the trick with
splitting at the proper spot -- that is, skipping over the continuous section
break and looking for the Next Section break. Another problem was presented
once it was placed in the new document, however: it would place the letter
into the new document, and then place a next section break where the
continuous section was supposed to be and then forget the parameters that
were initially set in the original continuous section break. But I have
remedied that and it is working beautifully.

I'm becoming addicted to this site and want to thank you and all the others
who have been instrumental in enabling me to be an effective scavenger. For
with each piece of code I grab here and there, I'm getting better and better
at being able to read the code and speak the language. Now, hopefully I'll
be able to post this in one shot (something is going on with this website???).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top