Adjusting font size of action buttons with VBA

Post Reply
Robster
Posts: 4
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 » Wed Nov 29, 2017 1:24 pm

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: 1569
Joined: Mon Dec 29, 2008 6:26 pm
OLAP Product: TM1
Version: PAL 2.0
Excel Version: 2016
Location: Brussels, Belgium
Contact:

Re: Adjusting font size of action buttons with VBA

Post by Wim Gielis » Wed Nov 29, 2017 5:14 pm

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

Excel Most Valuable Professional, 2011-2014
http://www.wimgielis.com ==> 104 TM1 articles and a lot of custom code
Newest blog article: Delete a cube and its dimensions

Robster
Posts: 4
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 » Tue Dec 05, 2017 12:11 pm

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

Post Reply