Consulting

Results 1 to 3 of 3

Thread: Solved: Select text in Form textbox

  1. #1
    Administrator
    VP-Knowledge Base
    VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location

    Solved: Select text in Form textbox

    I can go to a Form textbox using Textbox1.SetFocus. This does not select the text, although EnterFieldBehavior = 0. Any thought on how to do this?
    MVP (Excel 2008-2010)

    Post a workbook with sample data and layout if you want a quicker solution.


    To help indent your macros try Smart Indent

    Please remember to mark threads 'Solved'

  2. #2
    Knowledge Base Approver
    The King of Overkill! VBAX Master
    Joined
    Jul 2004
    Location
    Rochester, NY
    Posts
    1,727
    Location
    Hi Malcolm,

    The EnterFieldBehavior doesnt seem to pertain to when the focus is set programmatically.. what I've done in the past is [vba] With TextBox1
    .SetFocus
    .SelStart = 0
    .SelLength = Len(.Text)
    End With[/vba]Matt

  3. #3
    Administrator
    VP-Knowledge Base VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    Thanks Matt,
    That'll do nicely!
    Regards
    Malcolm
    MVP (Excel 2008-2010)

    Post a workbook with sample data and layout if you want a quicker solution.


    To help indent your macros try Smart Indent

    Please remember to mark threads 'Solved'

Posting Permissions

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