Adjusting font size of action buttons with VBA

Post Reply
Robster
Posts: 13
Joined: Tue Nov 22, 2016 9:53 am
OLAP Product: TM1
Version: 10.2.2
Excel Version: 2013

Adjusting font size of action buttons with VBA

Post by Robster »

Hello,

I'm trying to easily adjust the font size on any of my action buttons in a worksheet. I figured I just change the font size by editing the "OLEOobjects".

This is my piece of code which I use to try to adjust the font size:

Code: Select all

Debug.Print Blad1.OLEObjects("TIButton16").Object.Font.Size
Blad1.OLEObjects("TIButton16").Object.Font.Size = 12
Debug.Print Blad1.OLEObjects("TIButton16").Object.Font.Size
The first debug returns 112 as font size, which is correct. Then the second debug returns 12, due to the previous line changing the font size.

Unfortunately this doesn't seem to actually change something in the worksheet.

If I open the properties of the action button I can see it is still at size 112.

Does anyone know a solution to this problem?
Wim Gielis
MVP
Posts: 3103
Joined: Mon Dec 29, 2008 6:26 pm
OLAP Product: TM1, Jedox
Version: PAL 2.0.9.18
Excel Version: Microsoft 365
Location: Brussels, Belgium
Contact:

Re: Adjusting font size of action buttons with VBA

Post by Wim Gielis »

Hi there,

I ran accross the very same issue. Sometimes it works when you save, close and open the sheet, but it's not a guarantee.
So I decided to do it manually rather than automated.
Best regards,

Wim Gielis

IBM Champion 2024
Excel Most Valuable Professional, 2011-2014
https://www.wimgielis.com ==> 121 TM1 articles and a lot of custom code
Newest blog article: Deleting elements quickly
Robster
Posts: 13
Joined: Tue Nov 22, 2016 9:53 am
OLAP Product: TM1
Version: 10.2.2
Excel Version: 2013

Re: Adjusting font size of action buttons with VBA

Post by Robster »

Interesting, I'll try it with opening and closing the workbook. It's unfortunate that there isn't an easier way.
Post Reply