Word MailMerge LabelOptions problem

S

Simon Black

Hi,
Im currently developing an application which uses mailmerge in Word.The
problem is related to using the methods LabelOptions and CreateNewDocument.
The application is based in C# using late binding, we are currently testing
this with Office2003 on an XP Pro box.

The LabelOptions method exposes the Word dialog with the available label
choices etc. By making word visible you can see that after choosing a label
from the LabelOptions dialog sets the word document to the correct label. The
problem occurs when CreateNewDocument is called.

We pass in the some text in the Address argument of CreateNewDocument so
that we know where the address is located in the label, we then use text
substitution to replace this with the data from the data source which is a
datastructure in c#.

Everything seems to be fine if the label you have selected is from the same
list the dialog opened with, however if you choose a label from another list
and then call CreateNewDocument it has ignores your selection. Using the
property DefaultLabelName, LabelOptions sets this value but again only when
the item is from the same list the dialogbox is opened otherwise
DefaultLabelName remains unchanged.

This is my first post so I apologise if I have missed any information you
need to help.

Cheers.
 
C

Cindy M -WordMVP-

Hi Simon,

If you read the Help very carefully, you'll notice that there's no direct link
between the LabelOptions dialog box and CreateNewDocument. You use one, or the
other, but not both.

If you let the user work with the LabelOptions dialog box, then after a
selection is made, the current document should reflect that label type. In that
case, the document contains a table. You insert your basic label text into the
first cell, "propagate labels" to copy this to all the cells, then do the data
substitution.

Otherwise, your application has to provide the list of available labels, pick up
the user selection, and use that in the "Name" argument of CreateNewDocument.
Im currently developing an application which uses mailmerge in Word.The
problem is related to using the methods LabelOptions and CreateNewDocument.
The application is based in C# using late binding, we are currently testing
this with Office2003 on an XP Pro box.

The LabelOptions method exposes the Word dialog with the available label
choices etc. By making word visible you can see that after choosing a label
from the LabelOptions dialog sets the word document to the correct label. The
problem occurs when CreateNewDocument is called.

We pass in the some text in the Address argument of CreateNewDocument so
that we know where the address is located in the label, we then use text
substitution to replace this with the data from the data source which is a
datastructure in c#.

Everything seems to be fine if the label you have selected is from the same
list the dialog opened with, however if you choose a label from another list
and then call CreateNewDocument it has ignores your selection. Using the
property DefaultLabelName, LabelOptions sets this value but again only when
the item is from the same list the dialogbox is opened otherwise
DefaultLabelName remains unchanged.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or reply
in the newsgroup and not by e-mail :)
 
S

Simon Black

Thanks Cindy,

Problem solved.


Cindy M -WordMVP- said:
Hi Simon,

If you read the Help very carefully, you'll notice that there's no direct link
between the LabelOptions dialog box and CreateNewDocument. You use one, or the
other, but not both.

If you let the user work with the LabelOptions dialog box, then after a
selection is made, the current document should reflect that label type. In that
case, the document contains a table. You insert your basic label text into the
first cell, "propagate labels" to copy this to all the cells, then do the data
substitution.

Otherwise, your application has to provide the list of available labels, pick up
the user selection, and use that in the "Name" argument of CreateNewDocument.


Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)


This reply is posted in the Newsgroup; please post any follow question or reply
in the newsgroup and not by e-mail :)
 

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