I have tried to create a VBA macro to change the page colour and make it the same as the Microsoft Office-wide dark mode background.
My issue is that when I run the macro on a fresh document, it does not actually change the page colour at first. Going into Design>Page Colour shows me that the macro did indeed toggle the colour I want, but the page itself doesn't change accordingly. I have to press it manually for it to actually 'confirm'. Then, I can toggle/untoggle the colour through my macro without issues. Any ideas as to what is going wrong?
Here is my code:
Sub DarkMode()
'
' DarkMode Macro
If ActiveDocument.Background.Fill.Visible = msoFalse Then
ActiveDocument.Background.Fill.ForeColor.ObjectThemeColor = _
wdThemeColorText1
ActiveDocument.Background.Fill.ForeColor.TintAndShade = 0.15
ActiveDocument.Background.Fill.Visible = msoTrue
ActiveDocument.Background.Fill.Solid
Else
ActiveDocument.Background.Fill.Visible = msoFalse
End If
End Sub