Splitter Macro Error

  • Thread starter Thread starter Jennifer
  • Start date Start date
J

Jennifer

Hello. I have Word 97. And I am trying to run this
splitter Macro. I have attached the commands. But when it
get to the end "document type" it give me an error. Does
anyone know why I get this error?

I am trying to take a 50 page document and make 50
separate documents. PLease email me any suggestions. THANKS

Here is the macro:

Sub SplitLetterMacro()
'
' SplitLetterMacro Macro
' Macro recorded 11/26/2001 by Joan Miller
'
Selection.HomeKey Unit:=wdStory
Selection.Find.ClearFormatting
With Selection.Find
.Text = "^b"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute
Selection.HomeKey Unit:=wdStory, Extend:=wdExtend
Selection.Cut
Selection.Delete Unit:=wdCharacter, Count:=2
Documents.Add DocumentType:=wdNewBlankDocument
Selection.Paste
End Sub
 
Hi, Jennifer,

The reason for the error is that the macro was created in
Word 2000 (or possibly Word 2002). The Documents.Add
method in Word 97 doesn't have a DocumentType argument --
that was first introduced in Word 2000.

To fix your macro for Word 97, just delete
the "DocumentType:=wdNewBlankDocument" part of that line,
leaving only

Documents.Add

It will work the same (since wdNewBlankDocument is the
default document type, Word 2000 doesn't need it either).

Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://www.mvps.org/word
 
Back
Top