VBAMailer
asked on
Write Subdocuments from one large file into multiple files
Hi all,
I have one massive document created from the mail merge function in which I will separate each document with a page break to create a subdocument. I need to read each subdocument and based on number of pages, append it to a document with similar page count. So, not able find quite the right portion of the subdocument object to accomplish this, but here is my code, just need to know how to fill in the blank if statements. I'm sure it's something simple, but just can think of it.
doc.ActiveWindow.View = wdMasterView
For Each subdoc In doc.Subdocuments
Set newdoc = subdoc.Open
'Remove NextPage section breaks
'originating from mailmerge
RemoveAllSectionBreaks newdoc
If newdoc.BuiltInDocumentProp erties("Nu mber of pages") = 1 Then
Set printdoc = app.Documents.Open("C:\tes t1.doc")
' What to do here to write out newdoc into printdoc with only one page???
ElseIf newdoc.BuiltInDocumentProp erties("Nu mber of pages") = 2 Then
Set printdoc = app.Documents.Open("C:\tes t2.doc")
' What to do here to write out newdoc into printdoc with 2 pages???
Else newdoc.BuiltInDocumentProp erties("Nu mber of pages") = 3 Then
Set printdoc = app.Documents.Open("C:\tes t3.doc")
' What to do here to write out newdoc into printdoc 3 pages???
End If
docCounter = docCounter + 1
Next subdoc
I have one massive document created from the mail merge function in which I will separate each document with a page break to create a subdocument. I need to read each subdocument and based on number of pages, append it to a document with similar page count. So, not able find quite the right portion of the subdocument object to accomplish this, but here is my code, just need to know how to fill in the blank if statements. I'm sure it's something simple, but just can think of it.
doc.ActiveWindow.View = wdMasterView
For Each subdoc In doc.Subdocuments
Set newdoc = subdoc.Open
'Remove NextPage section breaks
'originating from mailmerge
RemoveAllSectionBreaks newdoc
If newdoc.BuiltInDocumentProp
Set printdoc = app.Documents.Open("C:\tes
' What to do here to write out newdoc into printdoc with only one page???
ElseIf newdoc.BuiltInDocumentProp
Set printdoc = app.Documents.Open("C:\tes
' What to do here to write out newdoc into printdoc with 2 pages???
Else newdoc.BuiltInDocumentProp
Set printdoc = app.Documents.Open("C:\tes
' What to do here to write out newdoc into printdoc 3 pages???
End If
docCounter = docCounter + 1
Next subdoc
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER