none
Set Built-in Theme Colour RRS feed

  • Question

  • I know that this seems stupid but I'm going to ask anyway.  I work in an office with several elderly folk who can be quiet stuck in their ways and seem to reject change at every opportunity, however each person has their own way and none can seem to agree on a common good.  Which leads me to this....  I have just finished developing a new template (Word 2010) for our technical writers which I had to create a standard company theme (loaded from a server location) to ensure conformance.  However the complaint is now that 'Arial is difficult to read' or 'I don't like the company colours as they hurt my eyes" etc. etc.  I tried applying the standard built-in theme based upon the USER but then Gary liked the Colours of Apex over the company theme (cause 'don't know about those colours you've used, a bloke wouldn't be seen wearing a shirt of that colour') whilst Helen wanted to have the Font from Civic with the colour of Verve because 'they made her feel happy inside. :)' So now I have to find a means in VBA to load specific built-in theme colours and fonts depending upon the user and then code in that the theme is returned to the company theme on doc close so that when the procedures are fowarded to managers for review/signatures they don't get overwhelmed by 'Helen's happy feeling inside.'  Now I'm at a loss as to how to achieve the loading of specific theme colours and fonts without applying the entire theme.  Initially I thought that I could cheat by just recording a Macro whilst I selected the individual Colour and Font themes but VBA just drew a blank. 

    Sub MakeEveryoneHappy()
        Dim WinUser, ThemePath, ThemeName, ThemeColor, ThemeFont As String
        
        WinUser = Environ("USERNAME")
        ThemePath = "C:\Program Files\Microsoft Office\Document Themes 14" & Application.PathSeparator
        Select Case WinUser
        
            Case "GARY"
                ThemeColor = "Apex" 'How to apply Apex Color theme??
                ThemeFont = "Black Tie" 'How to apply Black Tie Font theme??
                            
            Case "HELEN"
                ThemeColor = "Verve" 'How to apply Verve Color theme??
                ThemeFont = "Civic" 'How to apply Civic Font theme??
            
            Case Else
                ThemePath = "...\\" 'Server Path for Company Theme
                ThemeName = "Company.thmx"
                ActiveDocument.ApplyDocumentTheme ThemePath & ThemeName
        End Select
        
    End Sub
    I had hoped that there was some means with the ApplyTheme
    ActiveDocument.ApplyTheme.Color = ThemeColor
    but no such luck....  Please help as I'm not a software guy, I'm a Reliability Engineer who just has the misfortune to share the same office floor with these folk and some how THIS is reducing their productivity (and my chances of a bonus $$).  Open plan offices were the worst idea ever!  Any and all help/advice is greatly appreciated and thanks in advance.



    • Edited by DangerDraper Wednesday, September 19, 2012 8:59 AM forgotten expletive
    Wednesday, September 19, 2012 8:50 AM

Answers

  • Hi Danger

    Mmm, not something I know a lot about, but looking at the object model...

    Apparently, you can set the theme color, font or effects by loading the appropriate XML file for that part of a theme. For example:

    ActiveDOcument.DocumentTheme.ThemeFontScheme.Load _
      "C:\Program Files\Microsoft Office\Document Themes 12\Theme Fonts\Metro.xml"

    You have to specify the correct path to the theme parts - the above is the default path for Word 2007's built-in themes. Same approach for the color, just use the appropriate property (ThemeColorScheme),file location and file name.


    Cindy Meister, VSTO/Word MVP, my blog

    • Marked as answer by DangerDraper Thursday, September 20, 2012 12:21 AM
    Wednesday, September 19, 2012 12:24 PM
    Moderator

All replies

  • Hi Danger

    Mmm, not something I know a lot about, but looking at the object model...

    Apparently, you can set the theme color, font or effects by loading the appropriate XML file for that part of a theme. For example:

    ActiveDOcument.DocumentTheme.ThemeFontScheme.Load _
      "C:\Program Files\Microsoft Office\Document Themes 12\Theme Fonts\Metro.xml"

    You have to specify the correct path to the theme parts - the above is the default path for Word 2007's built-in themes. Same approach for the color, just use the appropriate property (ThemeColorScheme),file location and file name.


    Cindy Meister, VSTO/Word MVP, my blog

    • Marked as answer by DangerDraper Thursday, September 20, 2012 12:21 AM
    Wednesday, September 19, 2012 12:24 PM
    Moderator
  • Thanks Cindy, worked a treat for the colours and font.  The only dilema is that the custom Styles won't change font or colour type because of the way they were defined but that's a Tech Writer problem.  I think that I might nip this in the bud by rebuilding these custom Styles within VBA as the document loads.  Thanks for your help as it greatly appreciated. 
    Thursday, September 20, 2012 12:46 AM