Run-Time error '5941'

T

Todd K.

I have several Word merge documents set up with my database so that when the
user clicks a button, code in the database opens up the Word merge document.
When the Word document opens, code in the Word document runs the merge, makes
a copy of itself and closes the original. Here is a sample of my code in the
Word document:

Option Explicit

Private Sub Document_Open()

Me.MailMerge.OpenDataSource _
Name:="c:\DataSources\KYFDGOLDLGS GOLD_ProjectONESQL.odc", _
Connection:="Provider=SQLOLEDB.1;Integrated Security=SSPI;" & _
"Persist Security Info=False;Initial Catalog=GOLD_ProjectONESQL;data
source=KYFDGOLDLGS;", _
SQLStatement:="SELECT * FROM [TblTEMP_Labels_County]", _
subType:=wdMergeSubTypeOther

Me.MailMerge.Destination = wdSendToNewDocument
Me.MailMerge.Execute
Windows(Me).Close wdDoNotSaveChanges

End Sub

This worked fine until we just got new computers. I understand the new
computers (Dells) came with XP sp3 installed (VB5.7) and MS word has the
latest SP installed as well. The old computers (HP's) should have had XP sp2
which had VB5.6.

Now, when we try to run this, we get "Run-time error '5941': the requested
member of the collection does not exist". Any ideas?
 
T

Todd K.

Thanks Peter. Oddly enough, this problem seems to have worked itself out, as
the merge seems to be running properly (yes, fear me computer, for I am not
afraid to alter your inner code...). I will keep your reply handy should it
arise again.
 

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

Top