+ Reply to Thread
Results 1 to 13 of 13

Using Tab key within userform TextBox to tab to new line or paragraph

  1. #1
    Registered User
    Join Date
    09-07-2013
    Location
    Chester
    MS-Off Ver
    Home: 2011 for Mac Work: 2007
    Posts
    70

    Using Tab key within userform TextBox to tab to new line or paragraph

    Hi

    I have a Textbox within my userform where colleagues can enter additional information to their form submission, I'm having issues with the tab function that I'm hoping someone may be able to help.

    I have TabKeyBehaviour set to True which allows me to tab within the textbox, however when it tabs to the next line, rather than placing the cursor at the very start of the line at the left of the field, it tabs to one tab worth or space into the 2nd line (hope that makes sense) , and only allows typing from there, it doesn't allow typing from the far left of the box as I need

    Multiline is set to true in case that's relevant, and I've tried messing about with other propoerties however to no avail

    Does anyone know how to set the properties so tab aligns the cursor on the far left when tabbing to a new line?

    Thanks in advance

    Twaddy

  2. #2
    Forum Expert Tinbendr's Avatar
    Join Date
    06-26-2012
    Location
    USA
    MS-Off Ver
    Office 2010
    Posts
    2,125

    Re: Using Tab key within userform TextBox to tab to new line or paragraph

    Use Enter to start a new line.
    Change EnterKeyBehavior to true.
    David
    (*) Reputation points appreciated.

  3. #3
    Registered User
    Join Date
    09-07-2013
    Location
    Chester
    MS-Off Ver
    Home: 2011 for Mac Work: 2007
    Posts
    70

    Re: Using Tab key within userform TextBox to tab to new line or paragraph

    Hi Tinbendr

    Thanks very much for your reply and resolution, as simple as that.

    On a secondary point which you may be able to help with. The user form contents are transferred to an Outlook email before being sent to a distribution list, the email body is created in HTML format which works well, the only issue I've noticed which is linked to my initial post, is that if I enter for example 3 lines of text on separate lines in the text box, when it's transferred to the email body it is all placed together in one big paragraph, and I then need to manually split the lines out again. Do you know if it's possible so that the textbox contents are transferred exactly as entered on the userform?

    Many thanks

  4. #4
    Forum Expert Tinbendr's Avatar
    Join Date
    06-26-2012
    Location
    USA
    MS-Off Ver
    Office 2010
    Posts
    2,125

    Re: Using Tab key within userform TextBox to tab to new line or paragraph

    You'll have to change the chr(10) in the textbox to chr(13)

    MyText = Replace(TextBox1.Text, Chr10), Chr(13))

  5. #5
    Registered User
    Join Date
    09-07-2013
    Location
    Chester
    MS-Off Ver
    Home: 2011 for Mac Work: 2007
    Posts
    70

    Re: Using Tab key within userform TextBox to tab to new line or paragraph

    Hi

    Thanks for your reply, you'll have to forgive my basic coding knowledge, I'm not quite sure where I'd add your coding to my existing code as below. The textbox in question is highlighted in red. Would you mind indicating how I'd build in to my existing code please? Thanks

    Please Login or Register  to view this content.

  6. #6
    Forum Expert Tinbendr's Avatar
    Join Date
    06-26-2012
    Location
    USA
    MS-Off Ver
    Office 2010
    Posts
    2,125

    Re: Using Tab key within userform TextBox to tab to new line or paragraph

    Please Login or Register  to view this content.
    If that doesn't work, then use

    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    09-07-2013
    Location
    Chester
    MS-Off Ver
    Home: 2011 for Mac Work: 2007
    Posts
    70

    Re: Using Tab key within userform TextBox to tab to new line or paragraph

    Hi

    I've copied your code in to the email sub however I'm getting a Compile Error Syntax Error when I run the form

    Any thoughts?

    Many thanks

  8. #8
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Using Tab key within userform TextBox to tab to new line or paragraph

    Hello Twaddy006,

    I have made changes to your macro to add the Break tag to each line in the text box. This string is then concatenated with the HTML body. The changes are in Blue.

    Please Login or Register  to view this content.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  9. #9
    Forum Expert Tinbendr's Avatar
    Join Date
    06-26-2012
    Location
    USA
    MS-Off Ver
    Office 2010
    Posts
    2,125

    Re: Using Tab key within userform TextBox to tab to new line or paragraph

    Typo
    Please Login or Register  to view this content.

  10. #10
    Registered User
    Join Date
    09-07-2013
    Location
    Chester
    MS-Off Ver
    Home: 2011 for Mac Work: 2007
    Posts
    70

    Re: Using Tab key within userform TextBox to tab to new line or paragraph

    Hi Leith

    Thanks for your reply, I received a Compile Error: Expected error at the following step

    Please Login or Register  to view this content.

  11. #11
    Registered User
    Join Date
    09-07-2013
    Location
    Chester
    MS-Off Ver
    Home: 2011 for Mac Work: 2007
    Posts
    70

    Re: Using Tab key within userform TextBox to tab to new line or paragraph

    Hi Tinbendr

    Thanks for your latest coding, got it working ok thanks although needed to add a closing bracket at the end

    Please Login or Register  to view this content.
    Thanks for all your help, much appreciated

  12. #12
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Using Tab key within userform TextBox to tab to new line or paragraph

    You're both welcome for the inspiration.

  13. #13
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Using Tab key within userform TextBox to tab to new line or paragraph

    Hello

    It should read...
    Please Login or Register  to view this content.

+ 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. [SOLVED] VBA Line to Send Userform Info to Parent Userform Textbox
    By excelforumkeys in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-01-2014, 04:28 PM
  2. [SOLVED] Userform... (¶) how to remove the paragraph symbol?
    By ricku87 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-22-2013, 12:38 PM
  3. Last line of text in fully justified paragraph
    By ozbrian in forum Word Formatting & General
    Replies: 1
    Last Post: 12-21-2011, 12:53 AM
  4. Replies: 8
    Last Post: 11-07-2008, 09:26 AM

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