Results 1 to 3 of 3

Thread: Active X TextBox with fixed width, but dynamic height

  1. #1
    Member
    Join Date
    May 2020
    Posts
    66
    Rep Power
    5

    Active X TextBox with fixed width, but dynamic height

    I want to have an active x textbox with following option:

    1. Width of the textbox should be fixed (say 368.4)

    2. Minimum height of the textbox should be fixed (say 139.8), i.e., even if I delete all content of the textbox, the height of the textbox should not go below 139.8

    3. But maximum height of the textbox should be dynamic, i.e., if I have a big story to type, the height of the textbox should be expanded and adjusted accordingly.


    https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA
    https://eileenslounge.com/viewtopic.php?p=318868#p318868
    https://eileenslounge.com/viewtopic.php?p=318311#p318311
    https://eileenslounge.com/viewtopic.php?p=318302#p318302
    https://eileenslounge.com/viewtopic.php?p=317704#p317704
    https://eileenslounge.com/viewtopic.php?p=317704#p317704
    https://eileenslounge.com/viewtopic.php?p=317857#p317857
    https://eileenslounge.com/viewtopic.php?p=317541#p317541
    https://eileenslounge.com/viewtopic.php?p=317520#p317520
    https://eileenslounge.com/viewtopic.php?p=317510#p317510
    https://eileenslounge.com/viewtopic.php?p=317547#p317547
    https://eileenslounge.com/viewtopic.php?p=317573#p317573
    https://eileenslounge.com/viewtopic.php?p=317574#p317574
    https://eileenslounge.com/viewtopic.php?p=317582#p317582
    https://eileenslounge.com/viewtopic.php?p=317583#p317583
    https://eileenslounge.com/viewtopic.php?p=317605#p317605
    https://eileenslounge.com/viewtopic.php?p=316935#p316935
    https://eileenslounge.com/viewtopic.php?p=317030#p317030
    https://eileenslounge.com/viewtopic.php?p=317030#p317030
    https://eileenslounge.com/viewtopic.php?p=317014#p317014
    https://eileenslounge.com/viewtopic.php?p=316940#p316940
    https://eileenslounge.com/viewtopic.php?p=316927#p316927
    https://eileenslounge.com/viewtopic.php?p=316875#p316875
    https://eileenslounge.com/viewtopic.php?p=316704#p316704
    https://eileenslounge.com/viewtopic.php?p=316412#p316412
    https://eileenslounge.com/viewtopic.php?p=316412#p316412
    https://eileenslounge.com/viewtopic.php?p=316254#p316254
    https://eileenslounge.com/viewtopic.php?p=316046#p316046
    https://eileenslounge.com/viewtopic.php?p=317050&sid=d7e077e50e904a138c794e1 f2115da95#p317050
    https://www.youtube.com/@alanelston2330
    https://www.youtube.com/watch?v=yXaYszT11CA&lc=UgxEjo0Di9-9cnl8UnZ4AaABAg.9XYLEH1OwDIA35HNIei0z-
    https://eileenslounge.com/viewtopic.php?p=316154#p316154
    https://www.youtube.com/watch?v=TW3l7PkSPD4&lc=UgwAL_Jrv7yg7WWC8x14AaABAg
    https://teylyn.com/2017/03/21/dollarsigns/#comment-191
    https://eileenslounge.com/viewtopic.php?p=317050#p317050
    https://eileenslounge.com/viewtopic.php?f=27&t=40953&p=316854#p316854
    https://www.eileenslounge.com/viewtopic.php?v=27&t=40953&p=316875#p316875
    https://eileenslounge.com/viewtopic.php?p=316057#p316057
    https://eileenslounge.com/viewtopic.php?p=315915#p315915
    https://eileenslounge.com/viewtopic.php?p=316705#p316705
    https://eileenslounge.com/viewtopic.php?p=316704#p316704
    https://eileenslounge.com/viewtopic.php?p=176255#p176255
    https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA
    Last edited by DocAElstein; 07-27-2024 at 02:20 PM.

  2. #2
    Fuhrer, Vierte Reich DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    9,521
    Rep Power
    10
    Hi
    I may not be able to help too much, since I have no experience with Active X text boxes.

    I tried for the first time ever to get what you may be asking for . This is how it went. ( Using Excel 2007 )


    _1) I need the Developer ribbon ( You may already have this)
    ExcelOptions.JPG : https://imgur.com/p8gVo1y
    Show Developer tab in Ribbon.JPG : https://imgur.com/JcB0DCu
    Developer tab OK.JPG : https://imgur.com/W7y84A5

    _2) Insert the text box
    Developer Insert Text Box.JPG : https://imgur.com/qkcBkib
    Finally , move cross cursor to top left of where you want the text box, and then hold left mouse and drag window to size you want, or just click once to add the text box, ( https://support.microsoft.com/en-us/...a-001f3ecd6cd6 )

    _3) Make sure you are still in Design mode
    Still in Design Mode.JPG : https://imgur.com/qT3EVGS

    _4) right click in Text Boxwindow and select View Code
    Text Box View Code.JPG : https://imgur.com/l89FgZo

    _5) In the properties window you need to make 3 things True ( or = 1 )
    Text Box Autosize True.JPG : : https://imgur.com/vVNuefX
    Text Box Multiline True.JPG : https://imgur.com/1JrMRSX
    Enter Field Behavior True.JPG : https://imgur.com/wnupBCX

    _6) Give the Height and Width Properties that you want
    Text Box Width Height.JPG : https://imgur.com/Wn0xVQ2

    _7) Add this coding:
    Code:
    Private Sub TextBox1_Change()
        If TextBox1.Height < 139 Then Let TextBox1.Height = 139.8
     Let TextBox1.Width = 368.25
    End Sub
    _8) De select the Design mode by clicking once on the ribbon Design Mode icon , until it is no longer highlighted
    De Select Design Mode.JPG : https://imgur.com/DKR4Ky4
    De Selected Design Mode.JPG : https://imgur.com/UdvRsFk





    If that does not help, then I may not be able to help further, as I this was my first attempt at anything to do with a Text Box

    Alan



    Ref https://www.ozgrid.com/forum/index.p...eight-to-text/



    The Text Box in this file, appears to do something like you are asking for:
    ‘Book1.xlsm’ : https://app.box.com/s/2zw5tvwsz2daru9wboks1cgfygb4x9m2
    Last edited by DocAElstein; 06-04-2020 at 05:42 PM.

  3. #3
    Member
    Join Date
    May 2020
    Posts
    66
    Rep Power
    5
    I'm thankful for your help & time. The macro works well.

Similar Threads

  1. Replies: 2
    Last Post: 08-27-2015, 05:34 PM
  2. VBA Code To Autofit The Row Height Of Merged Cells
    By David Michael in forum Excel Help
    Replies: 6
    Last Post: 03-07-2014, 01:16 AM
  3. Replies: 1
    Last Post: 02-03-2014, 06:17 PM
  4. How to make Dynamic range (width) with OFFset function
    By Rajesh Kr Joshi in forum Excel Help
    Replies: 12
    Last Post: 12-01-2012, 11:03 PM
  5. Replies: 2
    Last Post: 11-08-2011, 08:52 AM

Posting Permissions

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