+ Reply to Thread
Results 1 to 11 of 11

Msgbox more than 2014 Characters

  1. #1
    Forum Contributor
    Join Date
    09-16-2014
    Location
    Hyderabad
    MS-Off Ver
    MS Office 2021
    Posts
    347

    Msgbox more than 2014 Characters

    Hi all,

    I using a code to display a array of texts which sometimes increases more than 1024 characters that Msgbox can accommodate.

    If the result is Morethan 1023 characters, it is getting truncated. So I am hoping for a workaround.

    Please help.
    Please Login or Register  to view this content.

  2. #2
    Forum Expert sweep's Avatar
    Join Date
    04-03-2007
    Location
    Great Sankey, Warrington, UK
    MS-Off Ver
    2003 / 2007 / 2010 / 2016 / 365
    Posts
    3,446

    Re: Msgbox more than 2014 Characters

    Hi,

    You could create a userform, add a label, resize it and set the caption property to your variable in the userform_initialize module

    Call the userform with something like
    Please Login or Register  to view this content.
    The 1 after the show command makes the form modal - ie, it needs to be closed before focus can be passed to another window.
    Rule 1: Never merge cells
    Rule 2: See rule 1

    "Tomorrow I'm going to be famous. All I need is a tennis racket and a hat".

  3. #3
    Forum Contributor
    Join Date
    09-16-2014
    Location
    Hyderabad
    MS-Off Ver
    MS Office 2021
    Posts
    347

    Re: Msgbox more than 2014 Characters

    Hi sweep,

    I am not adept at vb, can you please be more elaborate.

  4. #4
    Forum Contributor
    Join Date
    09-16-2014
    Location
    Hyderabad
    MS-Off Ver
    MS Office 2021
    Posts
    347

    Re: Msgbox more than 2014 Characters

    Hi sweep,

    I am not adept at vb, can you please be more elaborate.

  5. #5
    Forum Contributor
    Join Date
    09-16-2014
    Location
    Hyderabad
    MS-Off Ver
    MS Office 2021
    Posts
    347

    Re: Msgbox more than 2014 Characters

    I tried creating a user form but nothing happened, I get a blank box.

    Please Login or Register  to view this content.

  6. #6
    Forum Expert sweep's Avatar
    Join Date
    04-03-2007
    Location
    Great Sankey, Warrington, UK
    MS-Off Ver
    2003 / 2007 / 2010 / 2016 / 365
    Posts
    3,446

    Re: Msgbox more than 2014 Characters

    No problem.

    In the vba editor, add a user form:

    Insert > UserForm

    You will be presented with a window containing a blank userform, and a floating "Toolbox" window (if you don't see this, open it from the View menu)

    Add a label to the userform that occupies the majority of the blank space by clicking the label icon (a capital A) on the toolbox menu and then clicking and dragging on the userform. In the top left corner you should see "Label1"

    In the project explorer frame, select UserForm1 and then click

    View > Code

    In the object dropdown (Probably showing "(General)" select UserForm1
    In the procedure dropdown (Probably showing "Click" select Initialize

    Edit the Private Sub UserForm_Initialize() as follows:

    Please Login or Register  to view this content.
    Change your original code as follows:

    Please Login or Register  to view this content.

  7. #7
    Forum Contributor
    Join Date
    09-16-2014
    Location
    Hyderabad
    MS-Off Ver
    MS Office 2021
    Posts
    347

    Re: Msgbox more than 2014 Characters

    @Sweep, that was awesome.

    I am using userform to display few account heads which sometimes take more than 50 lines. However userform capacity is limited by Lable1 size (as much as I can drag). Can I add scroll so that all the lines are visible instead of limiting to size of label?

  8. #8
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,308

    Re: Msgbox more than 2014 Characters

    What do you expect the user to do with all this information?

  9. #9
    Forum Expert sweep's Avatar
    Join Date
    04-03-2007
    Location
    Great Sankey, Warrington, UK
    MS-Off Ver
    2003 / 2007 / 2010 / 2016 / 365
    Posts
    3,446

    Re: Msgbox more than 2014 Characters

    No scrollbars for a label (note that you could drag the corner to change the size of the userform and the label)

    Failing that you'd need to look at maybe a text box, or a combo box on the userform instead.

  10. #10
    Forum Contributor
    Join Date
    09-16-2014
    Location
    Hyderabad
    MS-Off Ver
    MS Office 2021
    Posts
    347

    Re: Msgbox more than 2014 Characters

    I am looking at anything that can be useful to me. If Userform doesn't than as you suggest I would be happy to use text box but only I do not know, how to do that.

    Can you please help me.

  11. #11
    Forum Expert sweep's Avatar
    Join Date
    04-03-2007
    Location
    Great Sankey, Warrington, UK
    MS-Off Ver
    2003 / 2007 / 2010 / 2016 / 365
    Posts
    3,446

    Re: Msgbox more than 2014 Characters

    Take a look at user form tutorials such as these

    http://www.excel-easy.com/vba/userform.html
    http://www.excel-vba.com/excel-vba-s...s-advanced.htm

    which should start you on a road to a solution.

+ 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. Macro to capture MsgBox prompt to a string variable but ignore the MsgBox
    By BuglerDobbs in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-07-2015, 10:56 AM
  2. the year value goes is still 2014
    By kwfine in forum Excel General
    Replies: 2
    Last Post: 12-29-2014, 03:20 AM
  3. Date Formatting 10.9.2014 to 9/10/2014
    By cory0789 in forum Excel General
    Replies: 7
    Last Post: 10-12-2014, 11:38 AM
  4. excel if and or 2014
    By kay2lkay in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 06-11-2014, 01:04 AM
  5. [SOLVED] Date order 2014-02-24 > 24-02-2014
    By Shimazu in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-10-2014, 06:00 AM
  6. [SOLVED] Problem with VBA Editor uses lower case on some lines (ex. msgbox instead of MsgBox)
    By stubbsj in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-14-2013, 06:59 PM

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