Microsoft KB Archive/828499

= You receive a &quot;Requested object is not available&quot; error message when you run a VBA macro during a mail merge in Word 2007 or in Word 2003 =

Article ID: 828499

Article Last Modified on 1/26/2007

-

APPLIES TO


 * Microsoft Office Word 2007
 * Microsoft Office Word 2003

-



SYMPTOMS
When you run a Microsoft Visual Basic for Applications (VBA) macro in Microsoft Office Word 2007 or in Microsoft Office Word 2003 that retrieves recipient information from a database, you may receive the following Run-time error message:

Requested object is not available.



CAUSE
This behavior may occur if you use the ActiveDocument.MailMerge.DataSource.Included property in your VBA macro and the database contains fewer than 10,000 records.

Note Databases that contain more than 10,000 records typically do not have recipient information.



WORKAROUND
Microsoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific requirements.

To work around this behavior, add the following Show method to your VBA macro: Application.Dialogs(wdDialogMailMergeRecipients).Show 1000 Note This method will show the Mail Merge Recipients dialog box for one second, and then continue with your macro.

Additional query words: WD2003 WD2007

Keywords: kberrmsg kbprb KB828499

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.