Save as in a VBA script

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
 
W

Word Heretic

G'day HKK <[email protected]>,

#1: Is commenting your code impossible?

#2: No idea what you are after mate, help me out please :)

Steve Hudson - Word Heretic

steve from wordheretic.com (Email replies require payment)
Without prejudice


HKK reckoned:
 
W

Word Heretic

G'day HKK <[email protected]>,

Which line fails?

Steve Hudson - Word Heretic

steve from wordheretic.com (Email replies require payment)
Without prejudice


HKK reckoned:
 

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