Labels in Word Object Model

S

Simon Woods

Hi

Is there an object in the Word object model which exposes a collection of
all the label specification found in Word. It is obviously available to
Word, but has it been made available to vba?

Thanks

Simon
 
J

Jean-Guy Marcil

Simon Woods was telling us:
Simon Woods nous racontait que :
Hi

Is there an object in the Word object model which exposes a
collection of all the label specification found in Word. It is
obviously available to Word, but has it been made available to vba?

Thanks

Simon

Are you writing about Caption Labels, as in:

'_______________________________________
Dim lblCUrrent As CaptionLabels
Dim i As Long

Set lblCUrrent = Application.CaptionLabels

For i = 1 To lblCUrrent.Count
MsgBox lblCUrrent(i).Name
Next
'_______________________________________

Or, mailing labels?
In this case, you have a custom label collection but no collection for all
the hundreds of built in labels that exists. See:

'_______________________________________
Dim myMailLbl As MailingLabel
Dim myCustLbl As CustomLabels
Dim i As Long

Set myMailLbl = Application.MailingLabel
Set myCustLbl = Application.MailingLabel.CustomLabels

MsgBox myMailLbl.DefaultLabelName

If myCustLbl.Count > 0 Then
For i = 1 To myCustLbl.Count
MsgBox myCustLbl(i).Name
Next
End If
'_______________________________________

--

Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
(e-mail address removed)
Word MVP site: http://www.word.mvps.org
 
S

Simon Woods

That's what I feared!

Thanks

Simon

Jean-Guy Marcil said:
Simon Woods was telling us:
Simon Woods nous racontait que :


Or, mailing labels?
In this case, you have a custom label collection but no collection
for all the hundreds of built in labels that exists. See:

'_______________________________________
Dim myMailLbl As MailingLabel
Dim myCustLbl As CustomLabels
Dim i As Long

Set myMailLbl = Application.MailingLabel
Set myCustLbl = Application.MailingLabel.CustomLabels

MsgBox myMailLbl.DefaultLabelName

If myCustLbl.Count > 0 Then
For i = 1 To myCustLbl.Count
MsgBox myCustLbl(i).Name
Next
End If
'_______________________________________
 

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