Mail Merge Macro just Stopped Working

G

Gilley

Good morning all,

I have had a mail merge macro working on Word 2000 for about two months
without any issues. Then about 2 weeks ago several users reported some
problems with error messages. I copied the templates back onto their
machines and the problem went away.

However, yesterday another much larger problem arose. On all machines (mine
included), we began receiving Error 5852 Requested Object Not Available.
This is a different message that we were receiving before.

I don't know if this had anything to do with it, but yesterday I was home
sick and made a directory path change on my home system which is running
Office 2003. Saved the changes then uploaded them to the office where they
were copied to everyones computers. It was after this we started to see the
Error 5852.

Here is the macro I am running. It is embedded in a template that is used
to merge data from a comma delimited file dumped to their system from a DOS
based program. A VB file launches Word with the template which then performs
the mail merge.

Private Sub Document_New()

With ActiveDocument.MailMerge
.SuppressBlankLines = True
.Destination = wdSendToNewDocument
.MailAsAttachment = False
.MailAddressFieldName = ""
.MailSubject = ""
.SuppressBlankLines = True
With .DataSource
.FirstRecord = wdDefaultFirstRecord
.LastRecord = wdDefaultLastRecord
End With
.Execute Pause:=True
End With

Application.Run macroname:="SettingBookmark"
Application.Run macroname:="OSDFileSaveAsRTF"

End Sub

The two macros called in this one are behaving perfectly. I have done some
searching on the Internet and can't find a good solution so I am hoping
someone here can help.

Thanks in advance.

Gilley
 
W

Word Heretic

G'day Gilley <[email protected]>,

What line causes the error?

Steve Hudson - Word Heretic

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


Gilley reckoned:
 
G

Gilley

Steve,

Thanks for the reply. It stops at the very beginning.

..SuppressBlankLines = True

It tells me that "Requested Object not Available" when I hover the mouse
over the line during the Debug.

Thanks for any light you can shed on this.

Regards,
Gilley
 
W

Word Heretic

G'day Gilley <[email protected]>,

Comment it out or add it in much further down.

Steve Hudson - Word Heretic

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


Gilley reckoned:
 
G

Gilley

Steve,

When I commented that specific line out, the same error was received on the
second line. When I commented out both the first and second lines, the error
showed up on the third. And so the pattern goes.

What I am most curious about is the saving of the macros in Word 2003, then
running them on Word 2000. This is when the problems began.

Thanks again for your help,

Gilley
 
W

Word Heretic

G'day Gilley <[email protected]>,

Hmm. I am wondering if its because you are doing it from Document_New.
Use an Application.Ontime command (see the eg in the MS help) to delay
execution of your code.

Steve Hudson - Word Heretic

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


Gilley 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

Similar Threads


Top