{"id":17232,"date":"2021-11-14T10:46:30","date_gmt":"2021-11-14T09:46:30","guid":{"rendered":"https:\/\/ekiwi-blog.de\/?p=17232"},"modified":"2021-11-14T10:53:02","modified_gmt":"2021-11-14T09:53:02","slug":"vba-button-change-font-size","status":"publish","type":"post","link":"https:\/\/ekiwi-blog.de\/en\/17232\/vba-button-change-font-size\/","title":{"rendered":"VBA: button change font size"},"content":{"rendered":"<p>With <abbr title=\"Visual Basic for Application\">VBA<\/abbr> many things can be automated under <em>Microsoft Office<\/em> applications. Among other things, forms can be created with the <em>Visual Basic Editor<\/em>, with which you can query and process user interactions. Such <a title=\"Open a userform with VBA\" href=\"https:\/\/ekiwi-blog.de\/en\/17115\/vba-function-to-open-a-form-userform-in-microsoft-office\/\">UserForms<\/a> always need at least one button (CommandButton) to trigger an action or event. Sometimes you have to <strong>adjust the font size of the button (CommandButton)<\/strong> for space or design reasons.<\/p>\n<figure id=\"attachment_17225\" aria-describedby=\"caption-attachment-17225\" style=\"width: 500px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/ekiwi-blog.de\/wp-content\/uploads\/2021\/11\/vba-button-commandbutton-fontsize-e1636882622255.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-17225\" src=\"https:\/\/ekiwi-blog.de\/wp-content\/uploads\/2021\/11\/vba-button-commandbutton-fontsize-e1636882622255.jpg\" alt=\"Screenshot of different font sizes in the CommandButton of a VBA UserForm\" width=\"500\" height=\"253\" \/><\/a><figcaption id=\"caption-attachment-17225\" class=\"wp-caption-text\">Using different font sizes on VBA button<\/figcaption><\/figure>\n<p>Unfortunately, this is not immediately obvious in the Visual Basic Editor, since you cannot find the property &#8220;<em>FontSize<\/em>&#8221; in the Properties-Window. Instead you have to go to the property &#8220;<em>Font<\/em>&#8221; in the properties-window and <strong>click on the button with the three dots &#8220;&#8230;&#8221;<\/strong>.<\/p>\n<p>If the properties window is not displayed, you can display it by pressing the <em>F4 key<\/em> or selecting <em>View =&gt; Properties Window<\/em>.<\/p>\n<figure id=\"attachment_17229\" aria-describedby=\"caption-attachment-17229\" style=\"width: 500px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/ekiwi-blog.de\/wp-content\/uploads\/2021\/11\/vba-button-commandbutton-font-properties-e1636882640553.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-17229\" src=\"https:\/\/ekiwi-blog.de\/wp-content\/uploads\/2021\/11\/vba-button-commandbutton-font-properties-e1636882640553.jpg\" alt=\"Screenshot VBA Editor property set font\" width=\"500\" height=\"408\" \/><\/a><figcaption id=\"caption-attachment-17229\" class=\"wp-caption-text\">Click the button with three dots at the &#8220;Font&#8221; property<\/figcaption><\/figure>\n<p>Now you get a dialog for the font, under which you can set all the properties of a font, including the font size (Size).<\/p>\n<figure id=\"attachment_17233\" aria-describedby=\"caption-attachment-17233\" style=\"width: 450px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/ekiwi-blog.de\/wp-content\/uploads\/2021\/11\/vba-set-font-siye.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-17233\" src=\"https:\/\/ekiwi-blog.de\/wp-content\/uploads\/2021\/11\/vba-set-font-siye.jpg\" alt=\"VBA Editor: Screenshot Dialag Font: Set font size\" width=\"450\" height=\"372\" srcset=\"https:\/\/ekiwi-blog.de\/wp-content\/uploads\/2021\/11\/vba-set-font-siye.jpg 450w, https:\/\/ekiwi-blog.de\/wp-content\/uploads\/2021\/11\/vba-set-font-siye-300x248.jpg 300w\" sizes=\"auto, (max-width: 450px) 100vw, 450px\" \/><\/a><figcaption id=\"caption-attachment-17233\" class=\"wp-caption-text\">Set font size in the font dialog<\/figcaption><\/figure>\n<p>Thus it is possible to change the <a href=\"https:\/\/ekiwi-blog.de\/en\/62449\/vba-outlook-setchange-font-and-font-size\/\" title=\"VBA Outlook: Set or change font and font size of an email\">font size<\/a> of the CommandButton but also generally the font size in the VBA form.<\/p>","protected":false},"excerpt":{"rendered":"<p>This article shows how to change font size of a button (CommandButton) in a VBA form. This can be done via the properties window.<\/p>\n","protected":false},"author":2,"featured_media":13630,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1555],"tags":[1701,1702,1704,1327,1858,1860,1700,1861,1705,1862,1706,1710],"class_list":["post-17232","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-software-en","tag-access-en","tag-excel-en","tag-microsoft-office-en","tag-microsoft-office","tag-microsoft-office-en-2","tag-programmierung-en","tag-programming","tag-vba-en-2","tag-vba-en","tag-visual-basic-for-application-en-2","tag-visual-basic-for-application-en","tag-word-en"],"_links":{"self":[{"href":"https:\/\/ekiwi-blog.de\/en\/wp-json\/wp\/v2\/posts\/17232","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ekiwi-blog.de\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ekiwi-blog.de\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ekiwi-blog.de\/en\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/ekiwi-blog.de\/en\/wp-json\/wp\/v2\/comments?post=17232"}],"version-history":[{"count":0,"href":"https:\/\/ekiwi-blog.de\/en\/wp-json\/wp\/v2\/posts\/17232\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/ekiwi-blog.de\/en\/wp-json\/wp\/v2\/media\/13630"}],"wp:attachment":[{"href":"https:\/\/ekiwi-blog.de\/en\/wp-json\/wp\/v2\/media?parent=17232"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ekiwi-blog.de\/en\/wp-json\/wp\/v2\/categories?post=17232"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ekiwi-blog.de\/en\/wp-json\/wp\/v2\/tags?post=17232"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}