View Single Post
 
Old 01-27-2022, 02:55 PM
Guessed's Avatar
Guessed Guessed is offline Windows 10 Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 4,176
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

Cross references of any kind actually do use hidden bookmarks which can only occur once in a document. But the basic setup for having language-specific content is not that complicated. Attached is a file showing how I set up a sample with content controls tagged with a language-specific code along with a macro that allows the user to select which language should be shown.
Code:
Sub LocaliseMe()
  Dim aCC As ContentControl, sLang As String
  sLang = InputBox("What language should be displayed? Your choices are: EN, DE, All", _
          "Choose Language Code", "All")
  
  For Each aCC In ActiveDocument.ContentControls
    Select Case sLang
      Case aCC.Tag
        aCC.Range.Font.Hidden = False
      Case "All"
        aCC.Range.Font.Hidden = False
      Case Else
        aCC.Range.Font.Hidden = True
    End Select
  Next aCC
  
  'set options to make ensure hidden text is not displayed on screen
  ActiveWindow.View.ShowAll = False
  ActiveWindow.View.ShowHiddenText = False
End Sub
Attached Files
File Type: docm SingleSource_LanguageExample.docm (33.6 KB, 7 views)
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote