Home |
Search |
Today's Posts |
#1
|
|||
|
|||
Error Code 4605 when running macro for saving each letter as a separate file
Thanks to Mr. Doug Robbins for his throw away macro to save each letter
created by a mail merge as a separate file. I have found this macro written by Doug Robbins somewhere from the web. It is working fine exactly as expected in my home PC.(Win XP - Office 2002). When I run it on my office PC the debug screen pos and showing error code 4605- This method or property is not availble because the object is empty. If we click the debug button following line is highlighted Source.Sections.First.Range.Cut If I hit F5 (continue) the action is completing. Infact if there is 10 documents to be saved I need to hit 10 times the debug and continue button. It is not the code problem as it it is working fine in home PC - ( I have tried in one more PC with WIN XP and office XP -It is fine). In office I have tried in 5 pc - In one computer it is OK. all othere gives same error. All office PCs are WIN XP-SP2 and office XP. May be some options need to be enabled to work this macro smoothly ??- Can anyone have any suggestion. Thanks in advance Jasy Sub SplitMerge1() ' splitter Macro ' Macro created by Doug Robbins to save each letter created by a mailmerge ' as a separate file. Dim Source As Document, oblist As Document, DocName As Range, DocumentName As String Set Source = ActiveDocument With Dialogs(wdDialogFileOpen) .Show End With Set oblist = ActiveDocument Counter = 1 While Counter oblist.Tables(1).Rows.Count Set DocName = oblist.Tables(1).Cell(Counter, 1).Range DocName.End = DocName.End - 1 'Change the path in the following command to suit where you want to save the documents. DocumentName = "D:\test\" & DocName.Text Source.Sections.First.Range.Cut Documents.Add Selection.Paste ActiveDocument.SaveAs filename:=DocumentName, FileFormat:=wdFormatDocument, LockComments:=False, Password:="", AddToRecentFiles:=True, WritePassword:="", ReadOnlyRecommended:=False, EmbedTrueTypeFonts:= _ False, SaveNativePictureFormat:=False, SaveFormsData:=False, _ SaveAsAOCELetter:=False ActiveWindow.Close Counter = Counter + 1 Wend End Sub |
Reply |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Macro Button Won't Stay on Toolbar | Microsoft Word Help | |||
Possible bug when recording a Word Macro | Microsoft Word Help | |||
Running a macro on a protected document. | Microsoft Word Help | |||
Running document macro from server | New Users | |||
2000 to 2002 macro and "Could not open macro storage" | Mailmerge |