+ Reply to Thread
Results 1 to 8 of 8

Auto adjust font size in a text box.

  1. #1
    Forum Contributor
    Join Date
    05-05-2004
    MS-Off Ver
    Office 365
    Posts
    651

    Auto adjust font size in a text box.

    I have attached an example sheet that I need some help with.

    As you can see, textbox1 contains some content but its overflowing, thus not displaying.

    Clicking the blue button will do is this:
    Get the word count (or characters whatever is easer) of the textbox and based on the number alter the font size to fix to the box.
    I don’t know if there is the ability to tell it to make the text fix the box (which would be GREAT) but if that does not exist, I will play with the actual Word count and the font size myself to find the optimal set up. Perhaps include the ability to alter the line spacing as well??? If that possible as I need to text to look as nice as I can make it.

    Thank you so much for your help with this.
    Attached Files Attached Files

  2. #2
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    Office 365 ProPlus
    Posts
    5,883

    Re: Auto adjust font size in a text box.

    You mean something like this?
    Please Login or Register  to view this content.
    ?Progress isn't made by early risers. It's made by lazy men trying to find easier ways to do something.?
    ― Robert A. Heinlein

  3. #3
    Forum Contributor
    Join Date
    05-05-2004
    MS-Off Ver
    Office 365
    Posts
    651

    Re: Auto adjust font size in a text box.

    Ahhhhhh.. YEAH.... exactly like that!!!! wow.... thanks so much!

    What happens of I have 3 different text boxes in on one page... how would i distinguish them from each other as each would be different in size.
    Last edited by sungen99; 11-06-2019 at 02:10 PM. Reason: adding more info

  4. #4
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    Office 365 ProPlus
    Posts
    5,883

    Re: Auto adjust font size in a text box.

    ... how would i distinguish them...
    You can check for shp.Name and use If/Case statement to apply separate logic for each.
    But if all textboxes use same logic (based on # of char), that's already handled in the code above via looping over shape objects in a worksheet. Type 17 = msoTextBox.

    https://docs.microsoft.com/en-us/off...e.msoshapetype

  5. #5
    Forum Contributor
    Join Date
    05-05-2004
    MS-Off Ver
    Office 365
    Posts
    651

    Re: Auto adjust font size in a text box.

    That is more advanced talk than i can understand. i have added a second one to the help file... could you show me how to do that? from that point i can do 2 or 20....

    thanks!
    Attached Files Attached Files

  6. #6
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    Office 365 ProPlus
    Posts
    5,883

    Re: Auto adjust font size in a text box.

    You don't need separate button.

    The sample code loops over every textbox and adjust according to condition.

    Alternately if you need specific one adjusted by code (ex: TextBox 3).

    Then code becomes...
    Please Login or Register  to view this content.

  7. #7
    Forum Contributor
    Join Date
    05-05-2004
    MS-Off Ver
    Office 365
    Posts
    651

    Re: Auto adjust font size in a text box.

    Ahhhh so if i wanted to be box specific i would just have a separate macro where i would change:

    Please Login or Register  to view this content.
    TextBox 3 to be whatever right?

  8. #8
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    Office 365 ProPlus
    Posts
    5,883

    Re: Auto adjust font size in a text box.

    That would be correct.

    There are other ways of handling (such as using arguments in subroutine etc), but this is simple way to handle things without going too much into detail.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 1
    Last Post: 11-03-2014, 05:07 PM
  2. Replies: 2
    Last Post: 01-16-2013, 03:42 AM
  3. auto-adjust cell size
    By StrawberryFields in forum Excel General
    Replies: 1
    Last Post: 05-31-2011, 01:01 PM
  4. font size auto adjust
    By loner2003 in forum Excel General
    Replies: 0
    Last Post: 09-21-2010, 02:17 PM
  5. List box - adjust the font size inside
    By thetallguy0 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 03-08-2008, 04:30 AM
  6. Auto adjust rows to size of contents
    By Howjos in forum Excel General
    Replies: 6
    Last Post: 07-04-2006, 12:20 PM
  7. [SOLVED] How do I adjust the font size in a Combo Box?
    By JessicaJ in forum Excel General
    Replies: 1
    Last Post: 10-25-2005, 01:05 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1