PDA

View Full Version : Language of Table and Figure Captions



Panavia
04-16-2020, 06:34 AM
Hey everyone,


the VBA Word API drives me nuts...
I'm importing content from a website into word and automatically assign Table Captions and Figure Captions to be summaries in List of Tables/Figures.


All this works fine with no problem. As of now I'm creating the captions with:

Selection.InsertCaption Label:=wdCaptionTable, Title:=Trim(innerTextString), Position:=wdCaptionPositionAbove


And the lists with:

ThisDocument.TablesOfFigures.Add Range:=Selection.Range, Caption:=wdCaptionFigure, IncludeLabel:=True, IncludePageNumbers:=True



The only issue I have is that the .dotm is used on machines with different language settings (for the OS as well as for Office). But I do want to always have the captions in English.


In order to ensure proper content language I set the following at different positions in the code:

ThisDocument.Content.LanguageID = wdEnglishUS


Now, for some weird reason the captions get displayed correctly in English as supposed, but several times they switch to the language the user has set globally (maybe in the standard template...?).


Does anyone know how to robustly set the language for the Table/Figure Captions to English, even if deployed on machines with different global language settings?


Thanks!
Your support is highly appreciated!
Tobias

Also posted under: https://www.msofficeforums.com/word-vba/44761-language-table-figure-captions.html

macropod
04-16-2020, 06:53 AM
Cross-posted at: https://www.msofficeforums.com/word-vba/44761-language-table-figure-captions.html
Please read VBA Express' policy on Cross-Posting in Rule 3: http://www.vbaexpress.com/forum/faq.php?faq=new_faq_item#faq_new_faq_item3