Page 2 of 2 FirstFirst 12
Results 11 to 15 of 15

Thread: Align TextBox Within A Range

  1. #11
    Member
    Join Date
    May 2020
    Posts
    66
    Rep Power
    5
    Thank you for the Active X textBox! It works, but only for height. The width of the textbox is shrinked automatically. This is a main reason I prefer to use normal TextBox, because width remain static for normal textbox.

  2. #12
    Member p45cal's Avatar
    Join Date
    Oct 2013
    Posts
    94
    Rep Power
    12
    Try something along these lines:
    Code:
    Private Sub TextBox1_GotFocus()
    With TextBox1
      .AutoSize = True
      .Left = Range("B1").Left
      .Top = Range("A356").Top
      .Width = 590
      .EnterKeyBehavior = True
    End With
    End Sub
    
    Private Sub TextBox1_LostFocus()
    With TextBox1
      .EnterKeyBehavior = False
      .Top = Range("A356").Top
      .Left = Range("B1").Left
      .Width = 590
      .AutoSize = False
      ht = .Height
      Debug.Print ht
      .Height = Application.Max(171, ht)
      Range("A356:A375").RowHeight = (.Height / 20)    ' + 0.5
      .Height = Range("A356:A375").Height
      Do While .Height < ht
        Range("A356:A375").RowHeight = Range("A356").RowHeight + 0.25
        .Height = Range("A356:A375").Height
      Loop
    End With
    End Sub

  3. #13
    Member
    Join Date
    May 2020
    Posts
    66
    Rep Power
    5
    Thanks a lot for helping me! It is working really well.

    When I close the document after entering something in the active x textbox, a popup comes with the message...
    "parts of your document may include personal information that can't be removed by document inspector"

    It can be disabled in Trust Center > Trust Center Settings > Privacy Options, but my question is - if I share this file to someone, is this pop-up comes every time they make any change to the textbox?? This may be annoying for them.

  4. #14
    Member p45cal's Avatar
    Join Date
    Oct 2013
    Posts
    94
    Rep Power
    12
    The file will retain the setting you give it in Trust Centre (as long as you save it), so that message should no longer pop up.

  5. #15
    Member
    Join Date
    May 2020
    Posts
    66
    Rep Power
    5
    Okay...thank you so much!!

Similar Threads

  1. Align Data In Groups Of Columns
    By Rick Rothstein in forum Rick Rothstein's Corner
    Replies: 0
    Last Post: 05-25-2015, 03:07 AM
  2. Replies: 4
    Last Post: 11-15-2013, 03:42 PM
  3. Replies: 9
    Last Post: 08-08-2013, 07:13 PM
  4. Align Shapes (Charts) On ActiveWorksheet
    By Rajan_Verma in forum Rajan Verma's Corner
    Replies: 1
    Last Post: 05-14-2012, 03:25 AM
  5. Replies: 2
    Last Post: 02-29-2012, 08:24 PM

Posting Permissions

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