Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 04-16-2020, 06:32 AM
Panavia Panavia is offline Language of Table and Figure Captions Windows 10 Language of Table and Figure Captions Office 2016
Novice
Language of Table and Figure Captions
 
Join Date: Apr 2020
Posts: 2
Panavia is on a distinguished road
Default 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
And the lists with:
Code:
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:
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: Language of Table and Figure Captions
Reply With Quote
  #2  
Old 04-16-2020, 06:52 AM
macropod's Avatar
macropod macropod is offline Language of Table and Figure Captions Windows 7 64bit Language of Table and Figure Captions Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

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]
Reply With Quote
  #3  
Old 04-16-2020, 03:57 PM
Guessed's Avatar
Guessed Guessed is offline Language of Table and Figure Captions Windows 10 Language of Table and Figure Captions Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 3,932
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

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
Reply With Quote
  #4  
Old 04-17-2020, 02:38 AM
Panavia Panavia is offline Language of Table and Figure Captions Windows 10 Language of Table and Figure Captions Office 2016
Novice
Language of Table and Figure Captions
 
Join Date: Apr 2020
Posts: 2
Panavia is on a distinguished road
Default

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
Reply With Quote
  #5  
Old 04-17-2020, 11:20 AM
Charles Kenyon Charles Kenyon is offline Language of Table and Figure Captions Windows 10 Language of Table and Figure Captions Office 2019
Moderator
 
Join Date: Mar 2012
Location: Sun Prairie, Wisconsin
Posts: 9,083
Charles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant future
Default

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.
Reply With Quote
  #6  
Old 04-19-2020, 03:54 PM
Guessed's Avatar
Guessed Guessed is offline Language of Table and Figure Captions Windows 10 Language of Table and Figure Captions Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 3,932
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

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
Reply With Quote
Reply

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
Language of Table and Figure Captions 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

Other Forums: Access Forums

All times are GMT -7. The time now is 05:13 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft