Reply
 
Thread Tools Display Modes
  #1   Report Post  
Alejandra Parra
 
Posts: n/a
Default 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   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 :-)

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 only creates first label when doing edit individual lab Scott H Mailmerge 1 January 19th 05 11:59 AM
custom label page size in mail merge (on a mac) Beee Mailmerge 1 January 7th 05 05:56 AM
Mail Merge Label layout. Brian Ellis Mailmerge 3 December 9th 04 05:32 PM
mail merge only prints one label per page Golpher Mailmerge 1 December 9th 04 12:47 AM
Mail Merge Zip Code will not format correctly ba Mailmerge 1 December 8th 04 02:15 AM


All times are GMT +1. The time now is 01:35 PM.

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"