Home |
Search |
Today's Posts |
#1
|
|||
|
|||
Label merge in code
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? TNX Alejandra Parra Mexico |
#2
|
|||
|
|||
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 :-) |
Reply |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Mail merge only creates first label when doing edit individual lab | Mailmerge | |||
custom label page size in mail merge (on a mac) | Mailmerge | |||
Mail Merge Label layout. | Mailmerge | |||
mail merge only prints one label per page | Mailmerge | |||
Mail Merge Zip Code will not format correctly | Mailmerge |