Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / December 2004

Tip: Looking for answers? Try searching our database.

Mail Merge Macro just Stopped Working

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Gilley - 17 Dec 2004 14:43 GMT
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
Word Heretic - 17 Dec 2004 22:26 GMT
G'day Gilley <Gilley@discussions.microsoft.com>,

What line causes the error?

Steve Hudson - Word Heretic

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

Gilley reckoned:

>Good morning all,
>
[quoted text clipped - 46 lines]
>
>Gilley
Gilley - 20 Dec 2004 14:13 GMT
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

> G'day Gilley <Gilley@discussions.microsoft.com>,
>
[quoted text clipped - 57 lines]
> >
> >Gilley
Word Heretic - 21 Dec 2004 14:29 GMT
G'day Gilley <Gilley@discussions.microsoft.com>,

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:

>Steve,
>
[quoted text clipped - 71 lines]
>> >
>> >Gilley
Gilley - 21 Dec 2004 18:10 GMT
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

> G'day Gilley <Gilley@discussions.microsoft.com>,
>
[quoted text clipped - 82 lines]
> >> >
> >> >Gilley
Word Heretic - 21 Dec 2004 22:54 GMT
G'day Gilley <Gilley@discussions.microsoft.com>,

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:

>Steve,
>
[quoted text clipped - 95 lines]
>> >> >
>> >> >Gilley

Rate this thread:






 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.