#1
|
|||
|
|||
Language of Table and Figure Captions
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: Code:
Selection.InsertCaption Label:=wdCaptionTable, Title:=Trim(innerTextString), Position:=wdCaptionPositionAbove Code:
ThisDocument.TablesOfFigures.Add Range:=Selection.Range, Caption:=wdCaptionFigure, IncludeLabel:=True, IncludePageNumbers:=True In order to ensure proper content language I set the following at different positions in the code: Code:
ThisDocument.Content.LanguageID = wdEnglishUS 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: Language of Table and Figure Captions |
#2
|
||||
|
||||
Cross-posted at: Language of Table and Figure Captions
For cross-posting etiquette, please read: Excelguru Help Site - A message to forum cross posters
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#3
|
||||
|
||||
This is topical for me as I have a client that wanted similar. The LanguageID of the content of the document is NOT going to work - this issue requires either Office or Windows language changes.
When I did some research on this topic it appeared that the values assigned to wdCaptionTable and wdCaptionFigure could be changed if you changed the language of the Application and then restarted Word. I tried this and had all Office apps open with the ribbon showing commands in the chosen language. BUT I was still getting 'Table' and 'Figure' so that didn't work for me. It also didn't help if I removed Normal.dotm and had Word recreate it. Perhaps it depends on the language version of Windows rather than the language in Office. I eventually gave up and created a vba Userform to allow the user to choose their preferred language and labels for both Tables and Figures. Then the macros I use for inserting captions lookup those stored preferences for the current doc.
__________________
Andrew Lockton Chrysalis Design, Melbourne Australia |
#4
|
|||
|
|||
Thanks Guessed,
what exactly did you pass on if the user selected a language in the Userform? The LanguageID, the Caption Labels? I thought about a workaround in which I add "Figure" and "Table" as custom caption labels and refer to them, instead of Caption:=wdCaptionFigure. Unfortunately my situation got weirder. It seems like the captions get properly labeled in English until the point when I insert the TableOfFigures. At this point all the captions in the document change their language. And this appears to happen randomly (which makes debugging a nightmare). I did change the style of TableOfFigures to English hoping that this solves the problem but this behaviour is very strange. I also thought about changing Normal.dotm to see if this property gets pulled from there for some reason. More details on your solution (which I would include without the Userform) are highly apprechiated! Tobias |
#5
|
|||
|
|||
Change their language as in showing as misspelled in the TOF but not misspelled in the caption?
Proofing language is a character level setting but will not be picked up in the TOF which will use the TOF style. |
#6
|
||||
|
||||
Inserting a TableOfFigures is not something I tried so that might be a clue to solving this mystery.
What I was doing was enabling a template to be customised for languages but this needed to be flexible enough so that multi-lingual authors can use the same template to edit a document in English and then open a different language doc. This means the language specificity would need to be associated with the document rather than the application or windows environment. The template has macros for inserting captions so the stored language settings can be used by the macros to put in the right field and label. I used the vba form to allow the user to select a language and change the caption labels. On the form, I prefill the label options based on the known languages but also allow the user to customise the labels if they need to.
__________________
Andrew Lockton Chrysalis Design, Melbourne Australia |
Thread Tools | |
Display Modes | |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Table captions changing to Figure captions and vice versa | alicatsmom | Word Tables | 0 | 06-11-2019 08:51 AM |
How to create multilevel figure/table captions | fencingfoz | Word | 3 | 04-18-2019 05:07 PM |
WORD is not descriminating between table and figure Captions | twrey | Word | 0 | 01-01-2016 03:58 PM |
Easily changing the position of figure and table captions | Inge Pakulski | Word | 4 | 10-07-2015 05:24 AM |
Broken Table/Figure Captions with Headings | kokopelli_2001 | Word | 1 | 06-07-2013 04:50 AM |