Reply
 
Thread Tools Display Modes
  #1   Report Post  
blabore
 
Posts: n/a
Default Mail Merge Into Word Text Box

I have a Visual Basic .Net applicaiton that is used to setup mail merge
fields in a word document. Basically, the app creates menus in Word that
allow a user to insert mail merge fields, then when the user saves the
document, it records what mail merge fields where used, so a corresponding
data document can be created for the letter. My problem is that somehow the
mail merge fields that appear within a text box are missing when I iterate
through the mail merge fields collection (i.e. MyDocument.MailMerge.Fields).
You can reproduce the problem by creating a blank mail merge letter,
inserting a text box into the document, then put one or more mail merge
fields inside of the text box. The MailMerge.Fields.Count will remain 0. This
is a problem because when I later try to actually merge the document, Word
informs me that these fields are not in my data document. Is this a bug in
Word, or is there another set of Mail Merge fields I need to look for? Any
help would be appreciated.
  #2   Report Post  
Graham Mayor
 
Posts: n/a
Default

Text boxes are not in the text layer of the document and do not work
correctly with merge fields within them. Use a frame or a table.

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org




blabore wrote:
I have a Visual Basic .Net applicaiton that is used to setup mail
merge fields in a word document. Basically, the app creates menus in
Word that allow a user to insert mail merge fields, then when the
user saves the document, it records what mail merge fields where
used, so a corresponding data document can be created for the letter.
My problem is that somehow the mail merge fields that appear within a
text box are missing when I iterate through the mail merge fields
collection (i.e. MyDocument.MailMerge.Fields). You can reproduce the
problem by creating a blank mail merge letter, inserting a text box
into the document, then put one or more mail merge fields inside of
the text box. The MailMerge.Fields.Count will remain 0. This is a
problem because when I later try to actually merge the document, Word
informs me that these fields are not in my data document. Is this a
bug in Word, or is there another set of Mail Merge fields I need to
look for? Any help would be appreciated.



  #3   Report Post  
blabore
 
Posts: n/a
Default

Graham,

Thanks for the help. Do you know of any way to at least detect if a text box
contains one or more merge fields? They way my app is setup, users pretty
much have full control over where they insert the merge fields. If possible,
I'd like a way to controls this behavoir, to avoid possible errors when the
merge is exectuted. Thanks again.

"Graham Mayor" wrote:

Text boxes are not in the text layer of the document and do not work
correctly with merge fields within them. Use a frame or a table.

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org




blabore wrote:
I have a Visual Basic .Net applicaiton that is used to setup mail
merge fields in a word document. Basically, the app creates menus in
Word that allow a user to insert mail merge fields, then when the
user saves the document, it records what mail merge fields where
used, so a corresponding data document can be created for the letter.
My problem is that somehow the mail merge fields that appear within a
text box are missing when I iterate through the mail merge fields
collection (i.e. MyDocument.MailMerge.Fields). You can reproduce the
problem by creating a blank mail merge letter, inserting a text box
into the document, then put one or more mail merge fields inside of
the text box. The MailMerge.Fields.Count will remain 0. This is a
problem because when I later try to actually merge the document, Word
informs me that these fields are not in my data document. Is this a
bug in Word, or is there another set of Mail Merge fields I need to
look for? Any help would be appreciated.




  #4   Report Post  
Graham Mayor
 
Posts: n/a
Default

Frankly no - though a macro to convert text boxes to frames might work

Sub BoxToFrame()
Dim oShp As Shape
For Each oShp In ActiveDocument.Shapes
oShp.ConvertToFrame
Next oShp
End Sub


--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org




blabore wrote:
Graham,

Thanks for the help. Do you know of any way to at least detect if a
text box contains one or more merge fields? They way my app is setup,
users pretty much have full control over where they insert the merge
fields. If possible, I'd like a way to controls this behavoir, to
avoid possible errors when the merge is exectuted. Thanks again.

"Graham Mayor" wrote:

Text boxes are not in the text layer of the document and do not work
correctly with merge fields within them. Use a frame or a table.

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org




blabore wrote:
I have a Visual Basic .Net applicaiton that is used to setup mail
merge fields in a word document. Basically, the app creates menus in
Word that allow a user to insert mail merge fields, then when the
user saves the document, it records what mail merge fields where
used, so a corresponding data document can be created for the
letter. My problem is that somehow the mail merge fields that
appear within a text box are missing when I iterate through the
mail merge fields collection (i.e. MyDocument.MailMerge.Fields).
You can reproduce the problem by creating a blank mail merge
letter, inserting a text box into the document, then put one or
more mail merge fields inside of
the text box. The MailMerge.Fields.Count will remain 0. This is a
problem because when I later try to actually merge the document,
Word informs me that these fields are not in my data document. Is
this a
bug in Word, or is there another set of Mail Merge fields I need to
look for? Any help would be appreciated.



  #5   Report Post  
blabore
 
Posts: n/a
Default

Graham,

Thanks again.

"Graham Mayor" wrote:

Frankly no - though a macro to convert text boxes to frames might work

Sub BoxToFrame()
Dim oShp As Shape
For Each oShp In ActiveDocument.Shapes
oShp.ConvertToFrame
Next oShp
End Sub


--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org




blabore wrote:
Graham,

Thanks for the help. Do you know of any way to at least detect if a
text box contains one or more merge fields? They way my app is setup,
users pretty much have full control over where they insert the merge
fields. If possible, I'd like a way to controls this behavoir, to
avoid possible errors when the merge is exectuted. Thanks again.

"Graham Mayor" wrote:

Text boxes are not in the text layer of the document and do not work
correctly with merge fields within them. Use a frame or a table.

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org




blabore wrote:
I have a Visual Basic .Net applicaiton that is used to setup mail
merge fields in a word document. Basically, the app creates menus in
Word that allow a user to insert mail merge fields, then when the
user saves the document, it records what mail merge fields where
used, so a corresponding data document can be created for the
letter. My problem is that somehow the mail merge fields that
appear within a text box are missing when I iterate through the
mail merge fields collection (i.e. MyDocument.MailMerge.Fields).
You can reproduce the problem by creating a blank mail merge
letter, inserting a text box into the document, then put one or
more mail merge fields inside of
the text box. The MailMerge.Fields.Count will remain 0. This is a
problem because when I later try to actually merge the document,
Word informs me that these fields are not in my data document. Is
this a
bug in Word, or is there another set of Mail Merge fields I need to
look for? Any help would be appreciated.




Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Mail Merge Word 2003 Issue S.Nicks Mailmerge 5 February 20th 09 01:55 AM
How do I create & merge specific data base & master documents? maggiev New Users 2 January 12th 05 11:30 PM
Excel worksheet in Word linked text boxes Eduardo Oliveira Page Layout 0 January 5th 05 11:23 PM
Outline Renee Hendershott Page Layout 2 December 25th 04 02:49 PM
Word 2002 Mail Merge - merging to new doc displays blank empty dia Steve Vincent Mailmerge 1 December 15th 04 06:28 PM


All times are GMT +1. The time now is 02:04 AM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"