Prevent Custom Theme from Affecting Spreadsheets?

bencar

Banned user
Joined
Jun 8, 2016
Messages
149
Hi. i got a win 10 custom theme installed. But it affects the background color of my spreadsheets. Is there a vba that can black any themes from affecting them?
 
Re: How Do I Prevent Custom Theme from Affecting Spreadsheets?

o Is your custom theme built in Windows or provided by a third-party company?
o My code attempts to solve the issue by applying an Office theme. If manually changing themes does not affect the background color, then this method can be discarded.
o I suggest you use a theme that gives the desired cell color.


Hi worf,

Its a CUSTOM theme provided by a 3rd party vendor.

As I mentioned a few times before, I want a code that blocks the theme from affecting excel.
 
Upvote 0

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.
Re: How Do I Prevent Custom Theme from Affecting Spreadsheets?

I do not think such a VBA exists. From the Internet:

gkhan(2) replied on <button title="See post history" class="msaActionText c-hyperlink message-user-info-link message-user-info-link-history" aria-expanded="false" aria-label="Date" ms.linkuserid="1b1ea22c-4b6c-4668-959e-26475f69c7b7" data-bi-linkuserid="1b1ea22c-4b6c-4668-959e-26475f69c7b7" data-paneltarget="#messageUserInfoHistoryc4be32b6-7207-476f-820f-7fe2bc1d6448" data-panelcontainer=".message-user-info" data-createddate="2017-10-10T07:40:05" data-bi-id="message-user-history-link">October 10, 2017</button>
<!-- MessageHistoryPanel.cshtml loaded via ajax -->

<button class="thread-message-content-reply-action-button msaActionText" data-bi-id="msgInReplyToLink">
rsp-in-reply-to.png
In reply to tkhyn's post on July 19, 2017 </button>

hi;
left Shift + left Alt + PrtScn
is the trick here I think.
you can quickly switch white mode and dark mode with seconds.
that helped me in this case.
I hope it helps you too
 
Upvote 0
Re: How Do I Prevent Custom Theme from Affecting Spreadsheets?

I do not think such a VBA exists. From the Internet:

Hi worf,

Appreciate it but the issue with that is it makes everything high contrast globally across the system.

i thought a VBA code could avoid my problem. But at least you tried and i thank you for it. Thanks anyway.
 
Upvote 0
Re: How Do I Prevent Custom Theme from Affecting Spreadsheets?

I would like to try one last thing. What is the undesired background color and what is the desired one? Is it white?
 
Upvote 0
Re: How Do I Prevent Custom Theme from Affecting Spreadsheets?

I would like to try one last thing. What is the undesired background color and what is the desired one? Is it white?

Hi worf,

Below is the pic thats currently being affected by the win 10 theme. The desired background color should be default obviously.

 
Last edited:
Upvote 0
Re: How Do I Prevent Custom Theme from Affecting Spreadsheets?

When opening the workbook, this code should reset the layout on the first sheet only.

o Press alt+F11 to go to the VBE.
o Right click This Workbook on the left pane.
o Choose the show code option and paste it on the right pane.


Code:
Private Sub Workbook_Open()


With Me.Worksheets(1).Cells
    .Borders.ColorIndex = 15
    .Borders.Weight = 1
    .Interior.ColorIndex = 0
End With
    
End Sub
 
Upvote 0
Re: How Do I Prevent Custom Theme from Affecting Spreadsheets?

When opening the workbook, this code should reset the layout on the first sheet only.

o Press alt+F11 to go to the VBE.
o Right click This Workbook on the left pane.
o Choose the show code option and paste it on the right pane.


Code:
Private Sub Workbook_Open()


With Me.Worksheets(1).Cells
    .Borders.ColorIndex = 15
    .Borders.Weight = 1
    .Interior.ColorIndex = 0
End With
    
End Sub

Hi worf,

I'm confused here. After I pasted this code I saved it as xlsm unless I'm wrong. If thats the case it didnt work anyway. Was I supposed to save it as xlsm? What do you suggest?
 
Upvote 0
Re: How Do I Prevent Custom Theme from Affecting Spreadsheets?

o Yes, XLSM is the correct extension.
o The version below will confirm that it executed when opening the workbook, tell me if it worked.
o I can post my test workbook if necessary.


Code:
Private Sub Workbook_Open()


With Me.Worksheets(1).Cells
    .Borders.ColorIndex = 15
    .Borders.Weight = 1
    .Interior.ColorIndex = 0
End With
MsgBox "The above sheet has been formatted.", 64, Me.Worksheets(1).Name


End Sub
 
Upvote 0
Re: How Do I Prevent Custom Theme from Affecting Spreadsheets?

o Yes, XLSM is the correct extension.
o The version below will confirm that it executed when opening the workbook, tell me if it worked.
o I can post my test workbook if necessary.


Code:
Private Sub Workbook_Open()


With Me.Worksheets(1).Cells
    .Borders.ColorIndex = 15
    .Borders.Weight = 1
    .Interior.ColorIndex = 0
End With
MsgBox "The above sheet has been formatted.", 64, Me.Worksheets(1).Name


End Sub

Hi worf,

Run I did see the message box confirming that the code executed correctly. But sadly the background color stays the same. What do you suggest?
H
 
Last edited:
Upvote 0
Re: How Do I Prevent Custom Theme from Affecting Spreadsheets?

If the sheet mentioned on the message box does not change colors, then VBA is overridden by the theme.
Please perform another test; apply some conditional formatting, such as cells turning green if the value is above zero, and see if the color displays correctly.
 
Upvote 0

Forum statistics

Threads
1,215,032
Messages
6,122,770
Members
449,095
Latest member
m_smith_solihull

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