run-time error '5941' after merging

K

koningh

Hi,

I'm working on an Word offertemplate, after lots of hardworking, it's
finished! But now there's a big problem, If the template is merged with
our CRM software (called Winris, a dutch company) The macro's won't
work anymore. If you use the template manualy all the macro's work
fine, but after merging (and even saving in the same directory as the
Template)you'll get the next error message:

Run-time error '5941'
The requested member of the collection does not exist.

ONly the index-macro still works fine (not connected to any external
file).
In the template I've used macro's like:

Sub AMwest()
'
' AMwest Macro
' Macro opgenomen op 31-10-03 door Receptie
'
ChangeFileOpenDirectory _
"F:\data\Public\Offerte documenten\Gegevens Accountmanager\"
ActiveDocument.Bookmarks("ButtonAM").Select
Selection.InsertFile FileName:="amwest.doc", Range:="", _
ConfirmConversions:=False, Link:=False, Attachment:=False
End Sub


I'm using word2000 and VB6, we use the crm-sw to merge the customername
and adress with the offer (one at a time). And then select severel
options (by non-working macros at the moment.

I hope someone can help me with this problem since we're dealing with
it for several months by now!

Thanx in Advance

B Meijer from the Netherlands



p.s. I just found out it's caused by the bookmarks wich are gone after
merging!:confused: Any idea anybody?
 
D

Doug Robbins - Word MVP - DELETE UPPERCASE CHARACT

You have found the cause of your problem, the bookmarks do not appear in the
document created by the mailmerge. Why don't you include an { INCLUDETEXT }
field in you mail merge maindocument instead. If the text to be inserted is
different for each record, you can have the filename in one of the data
fields and use a mergefield inside the { INCLUDETEXT } field. The way in
which you would do this is similar to the way in which you include a picture
in a mailmerge. You can find information on doing that in the "Graphic
from database" item under the "Special merges" section of fellow MVP CIndy
Meister's website at

http://homepage.swissonline.ch/cindymeister/MergFram.htm
--
Please post any further questions or followup to the newsgroups for the
benefit of others who may be interested. Unsolicited questions forwarded
directly to me will only be answered on a paid consulting basis.
Hope this helps
Doug Robbins - Word MVP
 
K

koningh

Thanx for your response.

I just solved the problem in another way.
I've made a template wich include the mergefields and a macro which
inserts a document containing the macro's with the bookmarks. It all
works fine now.!

thx
 

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