H
HKK
Hi,
I am a real newbie to script languages. I am trying to write a program that
takes a mail merge document and scripts it out into many sub-documents. With
the help of google I was able to find a script with a little tweaking is
doing what I need it to. I have hit a bump though with using the Save As
feature. I want the final document to be default save as value when saving in
Word (the first line). Here is the code I have written based on searching and
pasting together. I get a compliation error that states there is a missing
argument. I just can't figure out where. Any help is appreciated.
Thanks.
Sub SaveAllSubDocs(ByRef doc As Word.Document)
Dim subdoc As Word.Subdocument
Dim newdoc As Word.Document
Dim docCounter As Long
docCounter = 1
'Must be in MasterView to work with
'Subdocs as separate files
doc.ActiveWindow.View = wdMasterView
For Each subdoc In doc.Subdocuments
Set newdoc = subdoc.Open
'Remove NextPage section breaks
'originating from mailmerge
RemoveAllSectionBreaks newdoc
'Save as
With newdoc
Sub.FileSaveAs()
With Dialogs(wdDialogFileSaveAs)
.Name = ActiveDocument.BuiltInDocumentProperties("Title")
.Show
End With
End Sub
With Dialogs(wdDialogFileSaveAs)
.Name = ActiveDocument.BuiltInDocumentProperties("Title")
.Show
Next subdoc
I am a real newbie to script languages. I am trying to write a program that
takes a mail merge document and scripts it out into many sub-documents. With
the help of google I was able to find a script with a little tweaking is
doing what I need it to. I have hit a bump though with using the Save As
feature. I want the final document to be default save as value when saving in
Word (the first line). Here is the code I have written based on searching and
pasting together. I get a compliation error that states there is a missing
argument. I just can't figure out where. Any help is appreciated.
Thanks.
Sub SaveAllSubDocs(ByRef doc As Word.Document)
Dim subdoc As Word.Subdocument
Dim newdoc As Word.Document
Dim docCounter As Long
docCounter = 1
'Must be in MasterView to work with
'Subdocs as separate files
doc.ActiveWindow.View = wdMasterView
For Each subdoc In doc.Subdocuments
Set newdoc = subdoc.Open
'Remove NextPage section breaks
'originating from mailmerge
RemoveAllSectionBreaks newdoc
'Save as
With newdoc
Sub.FileSaveAs()
With Dialogs(wdDialogFileSaveAs)
.Name = ActiveDocument.BuiltInDocumentProperties("Title")
.Show
End With
End Sub
With Dialogs(wdDialogFileSaveAs)
.Name = ActiveDocument.BuiltInDocumentProperties("Title")
.Show
Next subdoc