Reply
 
Thread Tools Display Modes
  #1   Report Post  
Jasy
 
Posts: n/a
Default 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

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro Button Won't Stay on Toolbar caleb Microsoft Word Help 2 June 14th 05 11:59 PM
Possible bug when recording a Word Macro Raven95 Microsoft Word Help 4 April 30th 05 09:49 PM
Running a macro on a protected document. Kara Microsoft Word Help 1 April 26th 05 07:56 PM
Running document macro from server Intravler New Users 0 March 4th 05 04:33 AM
2000 to 2002 macro and "Could not open macro storage" Art Farrell Mailmerge 1 December 6th 04 12:40 PM


All times are GMT +1. The time now is 11:35 AM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"