+ Reply to Thread
Results 1 to 4 of 4

UserForm TextBox to printer

  1. #1
    Forum Contributor
    Join Date
    03-05-2007
    Location
    Falmouth, VA now, Palm Bay, FL for 2 yrs, was Colorado Springs, CO for ten years; Cedark Park, TX; Zeeland, MI; Wilmette, IL; Princeton Junction, NJ; NY, NY
    MS-Off Ver
    365
    Posts
    590

    UserForm TextBox to printer

    Once again, Hello folks!

    Though i have read a number of posts on the topic, i am not finding what will fit my problem. While it is just as likely that i have looked at a good solution as not, i have yet to recognize one.

    On a UserForm i have a multiline textbox. It is populated by the contents of a cell that has embedded vbCrLf in in to separate the lines for display.

    I want to create a commandbutton to print out the contents of this textbox.

    In order to also print out some other related information such as the date and title, i thought it best to print whatever related information i wanted to a temporary worksheet, then a few lines down, print the contents of the textbox. Using the code below does provide for each line that was separated by a vbCrLf to be on a separate line on the worksheet.

    The problem i am running into is that some of the entries when within the textbox automatically wrap, but when copied to cells in the worksheet, exceed the width of a printed sheet.

    I considered using another textbox on the temporary worksheet that, like the textbox on the UserForm, would automatically wrap the text, but if the contents of the textbox exceeded the height of the textbox, i presume that they would not show in the printout - am i wrong? I wouldn't want to risk truncating the information in the event that i needed to print it out. If there is a means to force the complete contents to print out, this would probably be the solution.

    I am wondering if there is a different approach to this that would solve my issue. If not, i can rethink what i am doing and probably come up with something, but if there is a solution out there i would feel pretty silly trying to re-invent it...

    As always, my thanks for your consideration!

    Herefollows the code i am presently using prior to adding the Application.Dialogs(xlDialogPrint).Show lines

    Please Login or Register  to view this content.

  2. #2
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    MS365 Apps for enterprise
    Posts
    5,913

    Re: UserForm TextBox to printer

    You have to apply wrap to cell. Try...

    Please Login or Register  to view this content.
    Another option is to Split(string,vbCrLf) and put that into array and cast it to different cells, then use columns().Autofit
    ?Progress isn't made by early risers. It's made by lazy men trying to find easier ways to do something.?
    ― Robert A. Heinlein

  3. #3
    Forum Contributor
    Join Date
    03-05-2007
    Location
    Falmouth, VA now, Palm Bay, FL for 2 yrs, was Colorado Springs, CO for ten years; Cedark Park, TX; Zeeland, MI; Wilmette, IL; Princeton Junction, NJ; NY, NY
    MS-Off Ver
    365
    Posts
    590

    Re: UserForm TextBox to printer

    TY! I'll work it up-

    Edit: In implementation the paste takes the multi-line contents from the UserForm TextBox that has embedded vbCrLf separating the lines within and places these lines on the worksheet, with each line that had a vbCrLf on its own row; therefore, i would need to wrap each line in the range of rows which was performed by simply inserting
    Please Login or Register  to view this content.
    I was experimenting with setting up a worksheet TextBox and found that i can set its properties to expand with the size of the text and thereby achieve my ends, but i find your solution to be a heck of a lot cleaner and the one with which i am going to proceed. Thank-you!!!
    Last edited by brucemc777; 04-15-2019 at 12:07 PM.

  4. #4
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    MS365 Apps for enterprise
    Posts
    5,913

    Re: UserForm TextBox to printer

    You are welcome Thanks for sharing your implemented solutions and for the rep.

+ 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. Select printer in a userform
    By Ismajr in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-30-2016, 01:11 PM
  2. Display Full Text within Textbox (On A UserForm) when you hover over the textbox
    By ShakJames in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 10-20-2015, 09:01 AM
  3. [SOLVED] Excel 2010 - Userform - display date from textbox in a label or textbox in 'ddd' format
    By theshybutterfly in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-29-2015, 10:54 PM
  4. Replies: 23
    Last Post: 07-12-2014, 07:09 PM
  5. Replies: 3
    Last Post: 05-07-2012, 09:46 PM
  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

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