Header
PowerPoint tips, hints and tutorials that will change your presentations for ever!

INDEX

 

Jigsaws
Sounds
Video
Custom Shows
vba code
NaviSlides
Games for teachers
Bullets
Triggers
Security
Flash Cards
Multiple Instances
PowerPoint 2007
Mail Merge
Random events
Animation
Hyperlinks
Set spellcheck language


Home buttonTutorial buttonContact buttonProducts button

How to Detect if Dark Mode is Used

If you are wrintg code for Office AddIns with custom ribbon images you may want to check if Dark Mode is being used used and specify different ribbon images depending n the mode in use.

You can check the Dark Mode type by checking the registry either manually or mor usefully with vba.

Registry Key

"HKEY_CURRENT_USER\Software\Microsoft\Office\16.0\Common\UI Theme"

How to Check with VBA

Sub check_Dark()
Dim myRegKey As String
Dim myvalue As Long
On Error Resume Next
myRegKey = "HKEY_CURRENT_USER\Software\Microsoft\Office\16.0\Common\UI Theme"
If myRegKey = "" Then Exit Sub
If RegKeyExists(myRegKey) Then
myvalue = RegKeyRead(myRegKey)
Select Case myvalue
Case 3
MsgBox "Dark Gray"
Case 4
MsgBox "Black"
Case 5
MsgBox "White"
Case 6
MsgBox "System"
Case 7
MsgBox "Colorful"
End Select
End If
End Sub

Function RegKeyRead(s_RegKey As String) As String
Dim myWS As Object
On Error Resume Next
'access Windows scripting
Set myWS = CreateObject("WScript.Shell")
'read key from registry
RegKeyRead = myWS.RegRead(s_RegKey)
End Function

Function RegKeyExists(s_RegKey As String) As Boolean
Dim WSO As Object
On Error GoTo Err
Set WSO = CreateObject("WScript.Shell")
WSO.RegRead s_RegKey
RegKeyExists = True
Exit Function
Err:
RegKeyExists = False
End Function

 

 

Back to the Index Page

POWERPOINT BLOG

Articles on your favourite sport

Free Microsoft PowerPoint Advice, help and tutorials, Template Links
This website is sponsored by Technology Trish Ltd
© Technology Trish 2007
Registered in England and Wales No.5780175
PowerPoint® is a registered trademark of the Microsoft Corporation