Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
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
Partner - Champion III
Partner - Champion III

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
Partner - Champion III
Partner - Champion III

jagan
Partner - Champion III
Partner - Champion III

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
Partner - Champion III
Partner - Champion III

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
Partner - Champion III
Partner - Champion III

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