+ Reply to Thread
Results 1 to 9 of 9

I want to substitute Msgbox for a UserForm textbox

  1. #1
    Registered User
    Join Date
    03-13-2017
    Location
    Manchester, England
    MS-Off Ver
    Excel 2013, version 15.0.4903.1002
    Posts
    20

    I want to substitute Msgbox for a UserForm textbox

    My actual code is huge, but works. Here is a smaller (test) version.
    The code outputs to a Msgbox, but it is untidy (can't format it). So I would like to output to a UserForm textbox1 (which I hope allows formatting).
    I have 2 UserForms.
    UserForm1 is purely for control, behind a command button is all the code. (see below)
    UserForm2 is for displaying the output in its textbox1.

    How do I substitute the Msgbox for a textbox1 and point it to the textbox1 area in UserForm2

    Please Login or Register  to view this content.

  2. #2
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: I want to substitute Msgbox for a UserForm textbox

    Hi,

    Instead of the Msgbox, load the second form, populate the textbox and then show the form
    Please Login or Register  to view this content.
    Don
    Please remember to mark your thread 'Solved' when appropriate.

  3. #3
    Registered User
    Join Date
    03-13-2017
    Location
    Manchester, England
    MS-Off Ver
    Excel 2013, version 15.0.4903.1002
    Posts
    20

    Re: I want to substitute Msgbox for a UserForm textbox

    Ahhh thanks for that. Yes it did output to the desired textbox. Unfortunately all the data was on just 1 line.
    I'll have to dig around now to see how to format the output from the 2 arrays. There must be an alternative to vbNewLine when using a Textbox.
    If you have a formatting solution (that will probably save me hours of digging) that would be great.

  4. #4
    Registered User
    Join Date
    03-13-2017
    Location
    Manchester, England
    MS-Off Ver
    Excel 2013, version 15.0.4903.1002
    Posts
    20

    Re: I want to substitute Msgbox for a UserForm textbox

    O.K. I've found Multiline True (in Properties) gives me the new lines. Now all I have to do is get the output into nice straight columns.

  5. #5
    Registered User
    Join Date
    03-13-2017
    Location
    Manchester, England
    MS-Off Ver
    Excel 2013, version 15.0.4903.1002
    Posts
    20

    Re: I want to substitute Msgbox for a UserForm textbox

    Question: Is it possible to make the Textbox dynamic, i.e. it grows according to the number of lines output to it???
    At the mo, the fixed size of the Textbox doesn't display all the lines of output. There is no vertical scroll bar to view them. Arghhhh help please.

  6. #6
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: I want to substitute Msgbox for a UserForm textbox

    You can set the Autosize property of the textbox. You can also set the ScrollBars property so that it will have scrollbars.

  7. #7
    Forum Expert
    Join Date
    02-14-2009
    Location
    .
    MS-Off Ver
    ................
    Posts
    2,840

    Re: I want to substitute Msgbox for a UserForm textbox

    Unless you use a fixed pitch font like Courier you cannot "get the output into nice straight columns".

  8. #8
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: I want to substitute Msgbox for a UserForm textbox

    One might also use a listbox instead if the output is all tabular in nature.

  9. #9
    Registered User
    Join Date
    03-13-2017
    Location
    Manchester, England
    MS-Off Ver
    Excel 2013, version 15.0.4903.1002
    Posts
    20

    Re: I want to substitute Msgbox for a UserForm textbox

    Thank you xlnitwit, it's all looking a lot better now. I'll play around with listbox in my spare time and see what it offers me.
    Much appreciated your advice.

+ 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] Msgbox from Userform - how to return to Userform and retain the inputs
    By nickersonpower in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-05-2017, 12:14 PM
  2. [SOLVED] Substitute Textbox value in a range argument
    By Purgatorium in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-30-2016, 11:37 AM
  3. [SOLVED] textbox instead of msgbox
    By al78310 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-14-2016, 08:48 PM
  4. Replies: 23
    Last Post: 07-12-2014, 07:09 PM
  5. Userform Syntax to have textbox display Msgbox when contents left unchanged
    By clemsoncooz in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 02-01-2012, 06:25 AM
  6. Userform Textbox updating a another userform textbox (im stuck!!)
    By wapwap in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 03-31-2011, 02:56 PM
  7. Code To Check blank textbox in userform with yes no msgbox
    By jwala in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-01-2010, 05:32 AM

Tags for this Thread

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