Hello Peter,
From your post, my understanding on this issue is: you wonder why Word does
not list the custom caption labels when looping through the CaptionLabel
collection, and how to work-around it. If I'm off base, please feel free to
let me know.
First of all, please let me explain why the custom caption labels are not
listed in the Application.CaptionLabels collection:
According to the KB article
http://support.microsoft.com/kb/114281, the
custom caption labels are stored in the Normal.dot template, which is an
application level setting, rather than a document level thing. If the Word
document is moved to another machine whose Normal.dot does not define the
custom caption labels, Word will not be aware of them when you loop through
Application.CaptionLabels collection. In my best guess, your add-in does
not find the correct custom caption list because the document is not on the
machine that defines these labels.
In order to work-around it, we can rebuild the custom caption label list by
iterating the Fields in the document. According to another KB article
http://support.microsoft.com/kb/195486, The field of caption labels is in
the form of
Label Name {SEQ Identifier [Switches]}
For instance, if you mouse-right-click on a Table caption label in a word
document, something like "Table {SEQ Table \* ARABIC}" will be shown.
Therefore, we can iterate all the fields with Word object model:
Document.Fields, and see if a field fits the form "{SEQ @@@ \* ¡Â}" where
@@@ is the name of the caption label. If it fits, and @@@ is not the system
built-in captions, we can say it is a custom caption label. What we need to
do next is to translate @@@ to the target language, then add it to
Application.CaptionLabels collection.
Please have a try and let me know if it works for you.
Regards,
Jialiang Ge (
[email protected], remove 'online.')
Microsoft Online Community Support
==================================================
For MSDN subscribers whose posts are left unanswered, please check this
document:
http://blogs.msdn.com/msdnts/pages/postingAlias.aspx
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications. If you are using Outlook Express/Windows Mail, please make sure
you clear the check box "Tools/Options/Read: Get 300 headers at a time" to
see your reply promptly.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.