Cannot Change Excel Ole object Command Button Text's Font property .Bold and .Italic = False

Clement Lo

New Member
Joined
Dec 17, 2024
Messages
1
Office Version
  1. 2003 or older
Platform
  1. Windows
Hi I have been struggling with this bugs for a few years and managed to resolve it today with copilot help.

It seem Microsoft have this .bold and .italic property set to a tristate Boolean , the traditional False and True value will always map it to True, You must use msoFalse for False value and msoTrue for True value .

e.g. to turn off the Bolding effect.
Code:
.Bold = msoFalse

More of this info here

MsoTriState Enum (Microsoft.Office.Core)

Specifies a tri-state Boolean value.

Hope your days are better when you solve this bug .

Cheers
 
Last edited by a moderator:

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
Hello,
It is not really a bug. Those values "msoTrue" etc. are simply "fancy names" for numeric constants (integers, not booleans) used internally. As it is easier for us to understand ".Bold = msoTrue" rather than ".Bold = -1".
It's the same as VbCrLf representing Chr(13) + Chr(10) for example.
If you use the values indicated in the table on the link you provided, instead of the names, it will work.
Like so :
VBA Code:
.Bold = -1
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,182
Members
453,021
Latest member
Mohamed Magdi Tawfiq Emam

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