VBA select (not change) default Excel 2019 colors scheme

Skiff

Board Regular
Joined
May 30, 2016
Messages
58
Office Version
  1. 2019
Platform
  1. Windows
Hello. I've got Excel file generated by third party software, which sets Office 2007-2010 color scheme. I want to select 'new' Office theme with VBA, but code returns empty.

I can change it manually and it works (on Excel ribbon :
Office color scheme.png
-->
Office color scheme - palette.png


But when I record a macro the file to load is empty
VBA Code:
ActiveWorkbook.Theme.ThemeColorScheme.Load()

When selecting from ribbon old color scheme - everything looks fine:
Office 2007-2010 color scheme.png
-->
Office 2007-2010 color scheme - palette.png

Code:
ActiveWorkbook.Theme.ThemeColorScheme.Load ("C:\Program Files\Microsoft Office\root\Document Themes 16\Theme Colors\Office 2007 - 2010.xml")


Selecting default theme also does not select correct default color scheme
Code:
ActiveWorkbook.ApplyTheme ("C:\Program Files\Microsoft Office\root\Document Themes 16\Office Theme.thmx")
Office theme.png

but it doesn't change color scheme to Office 2013 or later.

And to make things harder I cannot supply many users, that use the macro with my custom xml file.

I've had a solution somewhere on the web, but sadly I lost it. There was something in the 'ActiveWorkbook.Theme.ThemeColorScheme.Load' code that didn't require physical file on the hard drive.
 

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.

Forum statistics

Threads
1,216,179
Messages
6,129,329
Members
449,502
Latest member
TSH8125

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top