View Single Post
  #2   Report Post  
Cindy M -WordMVP-
 
Posts: n/a
Default

Hi Alejandra,

The reason for the error message is that LabelOptions was added to Word 2002
and was not present in Word 2000. When creating code to automate the Word
application you should always develop it in the OLDEST version you plan to
support. Generally, backwards compatibility (what worked in an older version
will continue to work in a new one) is present, but not the other way around.

I'm merging labels in code (in VB .Net)

I have the next code:

Dim doc1 As New Object 'Dim doc1 As New Word.Document
doc1 = CreateObject("Word.Document")
doc1 = app1.Documents.Add(documenttype:=Documento_Tipo_Do cumento)
'Word.WdDocumentType.wdTypeDocument
doc1.MailMerge.MainDocumentType =
DocumentoPrincipal_Tipo_EtiquetasDistribucion
'Word.WdMailMergeMainDocType.wdMailingLabels
doc1.MailMerge.OpenDataSource(strBD, linktosource:=True, Connection:="VIEW "
& strTipo, sqlstatement:="SELECT * FROM `" & strTipo & "`")
doc1.MailMerge.Application.MailingLabel.LabelOptio ns()

But in a computer with Word 2000 the next error is shown:

System.MissingMemberException: Public member 'LabelOptions' on type
'MailingLabel' not found.

Why is it?


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 :-)