Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

button font change in macro

Hi,

I have few buttons and I want to set its font style(bold/italic) in macro. can anybody tell me how do I do this??

Thanks in advance!!!

1 Solution

Accepted Solutions
jagan
Luminary Alumni
Luminary Alumni

Hi,

Try this Macro

SUB Font()

set obj = ActiveDocument.GetSheetObject("BU01")

set fnt = obj.GetFrameDef.Font

fnt.PointSize1000 = fnt.PointSize1000 + 1000

fnt.FontName = "Calibri"

fnt.Bold = true

fnt.Italic = true

fnt.Underline = true

obj.SetFont fnt

END SUB

Regards,

jagan.

View solution in original post

7 Replies
jagan
Luminary Alumni
Luminary Alumni

jagan
Luminary Alumni
Luminary Alumni

Hi,

Try this Macro

SUB Font()

set obj = ActiveDocument.GetSheetObject("BU01")

set fnt = obj.GetFrameDef.Font

fnt.PointSize1000 = fnt.PointSize1000 + 1000

fnt.FontName = "Calibri"

fnt.Bold = true

fnt.Italic = true

fnt.Underline = true

obj.SetFont fnt

END SUB

Regards,

jagan.

Not applicable
Author

Hi Jagan,

Thanks a lot for the reply

Is there a way to set all buttons font style using single line statement??

jagan
Luminary Alumni
Luminary Alumni

Hi,

Try like this

SUB Font()

set obj = ActiveDocument.GetSheetObject("BU01")

set fnt = obj.GetFrameDef.Font

fnt.PointSize1000 = fnt.PointSize1000 + 1000

fnt.FontName = "Calibri"

fnt.Bold = true

fnt.Italic = true

fnt.Underline = true

obj.SetFont fnt

set obj = ActiveDocument.GetSheetObject("BU02")

obj.SetFont fnt


set obj = ActiveDocument.GetSheetObject("BU03")

obj.SetFont fnt


set obj = ActiveDocument.GetSheetObject("BU04")

obj.SetFont fnt

END SUB

Regards,

Jagan.

Not applicable
Author

Hi Jagan,

I got what you are trying to say, tried, and its working also. Thanks a lot for that

But I just wanted to know whether there is any way using which we can set all buttons font style instead of doing individually as below

set obj = ActiveDocument.GetSheetObject("BU04").

jagan
Luminary Alumni
Luminary Alumni

Hi,

I think No, you have to manually assign for each and every object.  Try using for or while loops if their pattern of IDs are same like BU01, BU02, BU03 etc.

Regards,

Jagan.

Not applicable
Author

Okay.. Thanku