Autotext

J

John

Hi all

My query is about the Autotextentry object. Can it be used to represent a mail merge field? What I was thinking about was creating and sending from VB6 a list of Autotextentries to Word XP. Then I wanted to use these entries as mail merge fields in that specific document. Is this possible

Thanks in advance

Peter
 
C

Charles Kenyon

An AutoText entry can contain one or more merge fields. Be sure to use
AutoTextEntries(item).Insert to get it into your document. If you transfer
it through a string, it will lose its field characteristics. (Just found
this out this week, and may have it a bit confused.)
--

Charles Kenyon

See the MVP FAQ: <URL: http://www.mvps.org/word/> which is awesome!
--------- --------- --------- --------- --------- ---------
This message is posted to a newsgroup. Please post replies
and questions to the newsgroup so that others can learn
from my ignorance and your wisdom.

John said:
Hi all,

My query is about the Autotextentry object. Can it be used to represent a
mail merge field? What I was thinking about was creating and sending from
VB6 a list of Autotextentries to Word XP. Then I wanted to use these entries
as mail merge fields in that specific document. Is this possible?
 
C

Charles Kenyon

I have only used vb6 three times so can't advise you about that.

Generally when doing a merge from outside Word I would recommend having a
merge template or document already existing. Use your outside process to set
up your data source and then open the merge document (or create a new
document based on your template). Run the merge to a new document.

I really don't have a clue as to what you are trying to do. Merge fields are
holders for data from a merge data source. As I said earlier, you can have
AutoText entries that hold such fields. It is unusual to be changing the
fields being used, but not unheard of. I have a template that uses different
paragraphs (including merge fields) depending on a choice checked by the
user when the document is first created.

If you are using only a single record and trying to automate insertion of
data from that record, you can use a merge. You can also simply assign your
pieces of data to variables in a vba procedure and place them in your
document at bookmarks or using DocVariable or DocProperty fields. Why are
you using a merge? Why do you need merge fields in AutoText rather than in
your document/template?
--

Charles Kenyon

See the MVP FAQ: <URL: http://www.mvps.org/word/> which is awesome!
--------- --------- --------- --------- --------- ---------
This message is posted to a newsgroup. Please post replies
and questions to the newsgroup so that others can learn
from my ignorance and your wisdom.

John said:
Thanks Charles for your reply.

I have 2 more queries if you are aware:

1) Once the Autotextentries are copied into Word, how can I convert them
into mail merge fields from VB6. In fact how do I make this Word document a
mail merge document from VB6( I will use another Word document as its
Datasource) so that any time I open the file I can insert these merge fields
?
 
J

John

Apologies Charles for not making myself clear

What I am trying to do is use VB6 to create merge fields, then send them to a Word document and store them as Autotext entries. I then want to open Word and place these fields into specific locations and print this document using another Word document as the Datasource
I have tried creating the fileds in VB6 and inserting them into a new document (saved as a Template) and then added them to the AutextEntries collection. When I am in Word and attempt to insert the fields nothing appears

Do you have any idea

Thanks again

John
 

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