1. Home
  2. Docs
  3. How to…
  4. How To: Change Font Name and Font Size

How To: Change Font Name and Font Size

If you want to change the Font Name and (or) the Font Size of all controls on a Virtual Form you can do this with 1 line of VBA code.

Here is how to do this in the sample workbook that you can find in the downloaded file.

Sample file: Ordering Management System Excel

From this sample file if you click on “Open Main Menu” > “Orders”  you will get this screen:

 

Lets now open the VBA Editor.

 

 

In VBA Editor right mouse click on frmMainMenu and in menu select View Code.

 

 

When you open the code window it looks like this:

Now add this 2 lines of code in the subprocedure that opens the form when we click on cmd1 Button:


First line of code changes the font for all controls that are on the Virtual Form.

Second line of code changes the size of all controls on the Virtual Form.

All the controls will be resized and repositioned regarding to new font and size because we have changed it before we opened the Virtual Form.

 

 

If we now go and open the “Orders” Virtual Form from Main Menu it will look like this:

 

 

Or if we use for example:


 

It will look like this:

Was this article helpful to you? Yes 5 No

How can we help?