J
jim
I work for a business that uses third-party software to merge data
from our customer database into individual letters in Word 2000. I
create a main document as a form letter, insert all of the appropriate
merge fields and identify the main document to the software. I do not
actually perform the mailmerge in Word; the third party software finds
the proper customer record, does the merge, and I get a new document
that is merged with all the data in the proper spots and in all
respects looks just like any formletter that I could merge through
Word 2000.
After the merge happens and I get a newly merged document, I would
like the user to be able to run a VBA macro that will allow the user
to save the new document with a filename that is based on the contents
of several of the mergefields. However, after the merge
ActiveDocument.MailMerge.DataSource.DataFields(index).Value
gives me a runtime error 5852 "Requested object not available" for any
correct value of index and therefore I have no data to massage into a
properly constituted filename. If I try to access this before the
merge is done, I have values in each of the DataFields and I can
massage that data in any way necessary to create a filename, but I
don't know how to save it for after the merge or how to pass it
through the merge to the other side so that it exists after the merge.
I had originally tried to set the title property in the merge document
in this manner {TITLE "{MERGEFIELD f15}{MERGEFIELD f12 \@ "' exam'
M-d-yyyy"}"} so that I could access it through using
ActiveDocument.BuiltInDocumentProperties(wdPropertyTitle), but setting
the title that way does not always work for me and I don't need the
title of the document showing up anywhere in the text, which happens
by using the {TITLE} field
How can I (or can I at all) carry the contents of the data fields that
I need to create my properly constituted filename past the mailmerge
process, or in the alternative, how and where can I save it
"pre-merge" so that I can use it "post-merge?"
Any hope for me?
jim
from our customer database into individual letters in Word 2000. I
create a main document as a form letter, insert all of the appropriate
merge fields and identify the main document to the software. I do not
actually perform the mailmerge in Word; the third party software finds
the proper customer record, does the merge, and I get a new document
that is merged with all the data in the proper spots and in all
respects looks just like any formletter that I could merge through
Word 2000.
After the merge happens and I get a newly merged document, I would
like the user to be able to run a VBA macro that will allow the user
to save the new document with a filename that is based on the contents
of several of the mergefields. However, after the merge
ActiveDocument.MailMerge.DataSource.DataFields(index).Value
gives me a runtime error 5852 "Requested object not available" for any
correct value of index and therefore I have no data to massage into a
properly constituted filename. If I try to access this before the
merge is done, I have values in each of the DataFields and I can
massage that data in any way necessary to create a filename, but I
don't know how to save it for after the merge or how to pass it
through the merge to the other side so that it exists after the merge.
I had originally tried to set the title property in the merge document
in this manner {TITLE "{MERGEFIELD f15}{MERGEFIELD f12 \@ "' exam'
M-d-yyyy"}"} so that I could access it through using
ActiveDocument.BuiltInDocumentProperties(wdPropertyTitle), but setting
the title that way does not always work for me and I don't need the
title of the document showing up anywhere in the text, which happens
by using the {TITLE} field
How can I (or can I at all) carry the contents of the data fields that
I need to create my properly constituted filename past the mailmerge
process, or in the alternative, how and where can I save it
"pre-merge" so that I can use it "post-merge?"
Any hope for me?
jim