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

Announcements
Qlik Connect 2026 Agenda Now Available: Explore Sessions
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Font Size Macro

Hello all,

Does anyone have a macro expression to change the font size automatically? I have noticed that when you try to present something you sometimes have to change the screen size. I have a button running a macro for that but now I wondered if the same could be done for Font Size?

Thank you in advance!

K

1 Solution

Accepted Solutions
Not applicable
Author

Here is what it would be for the entire sheet:

sub changeFont

     set sheet = ActiveDocument.ActiveSheet

               for i=0 to sheet.NoOfSheetObjects-1

                              set sheetObject = sheet.SheetObjects(i)

                              font = sheetObject.GetFrameDef.Font

                              font.PointSize1000 = font.PointSize1000 + 1000

                              sheetObject.setFont font

               next

end sub

When you go back to the configure module after executing a macro it generally will say at the top that you have an error in your macro.  But the above should work.

Good Luck!

Brandon

View solution in original post

5 Replies
Not applicable
Author

This increases the font size for object TB01 by 1 pt each time you press it.  You could replace TB01 with any object you want to change the font size on.

In a macro define something like the following:

sub changeFont

set chart = ActiveDocument.GetSheetObject("TB01")

fnt = chart.GetFrameDef.Font

fnt.PointSize1000 = fnt.PointSize1000 + 1000

chart.SetFont fnt

end sub

Then attach the macro changeFont to your button.  If you wanted you could probably make another button with a different macro of  fnt.PointSize1000 = fnt.PointSize1000 -1000 to reduce the font size. 

Hope this helps!

-Brandon

Not applicable
Author

Hey Brandon,

Thanks a lot!

The purpose is to change it for the entire sheet so I changed it to:

sub changeFont

    set mysheet=ActiveDocument.ActiveSheet

    fnt = chart.GetFrameDef.Font

    fnt.PointSize1000 = fnt.PointSize1000 + 1000

    chart.SetFont fnt

end sub

But when i click the button i'm sent back to the configure module page

Not applicable
Author

Here is what it would be for the entire sheet:

sub changeFont

     set sheet = ActiveDocument.ActiveSheet

               for i=0 to sheet.NoOfSheetObjects-1

                              set sheetObject = sheet.SheetObjects(i)

                              font = sheetObject.GetFrameDef.Font

                              font.PointSize1000 = font.PointSize1000 + 1000

                              sheetObject.setFont font

               next

end sub

When you go back to the configure module after executing a macro it generally will say at the top that you have an error in your macro.  But the above should work.

Good Luck!

Brandon

Not applicable
Author

Hi Brandon,

i have a litte question. I hope thats ok. With your Macro you can change Font Size of Text in the Table. What Object i have to use to change font size of a CHART Title

I tried with

font = sheetObject.GetProperties

font.ChartProperties.Title.Font.PointSize = 80000

but thats just the size of a Textfield in the chart. I can´t find the object for the title.

It would be great if you can help me. Thank you very much in advance!!!

Jezzeblue

paulbridge
Contributor
Contributor

Hi Jezzeblue

RE: MACRO VB SCRIPT  Change Caption Title Font Size

I have been working on a script similar to what you are after. I have appended a snippet below;

--------------------------------------------

sub changechartcaptionfont

SET chart = ActiveDocument.GetSheetObject("CH199")

chartProp = chart.GetProperties

chartProp.GraphLayout.Frame.CaptionFont.PointSize1000 = 8000

chart.SetProperties chartProp

end sub

--------------------------------------------

Hope it helps

Regards

Paul

Message was edited by: paulbridge - added key words to facilitate searching