+ Reply to Thread
Results 1 to 11 of 11

Printing a userform and displaying a chart upon finish VBA program

  1. #1
    Registered User
    Join Date
    01-18-2013
    Location
    Baton Rouge, LA
    MS-Off Ver
    MS Office 2010
    Posts
    25

    Printing a userform and displaying a chart upon finish VBA program

    I am trying to print the data that was used as input for the userform and display results on a chart. I have created the chart already. The userform has too much information to remember and I would like it to be automatically printed upon completion of the code. I have a message box that pops up when the code is done running. Once you click "Ok", the userform should be printed and the chart displayed.

    Here is the code for the message box:

    Please Login or Register  to view this content.
    Instead of the program ending, the following actions should take place.
    Last edited by damayn83; 02-12-2013 at 12:50 PM.

  2. #2
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Printing a userform and displaying a chart upon finish VBA program

    Hi damayn83

    I can show you Code to do a Print Preview of your UserForm
    Please Login or Register  to view this content.
    And I can show you Code to save the UserForm to a PDF
    Please Login or Register  to view this content.
    And I can show you Code to Print your UserForm
    Please Login or Register  to view this content.
    Can't help you implement without seeing what you have and what you're trying to do.
    Last edited by jaslake; 02-08-2013 at 11:08 PM.
    John

    If you have issues with Code I've provided, I appreciate your feedback.

    In the event Code provided resolves your issue, please mark your Thread as SOLVED.

    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

  3. #3
    Registered User
    Join Date
    01-18-2013
    Location
    Baton Rouge, LA
    MS-Off Ver
    MS Office 2010
    Posts
    25

    Re: Printing a userform and displaying a chart upon finish VBA program

    jaslake, does all the code need to be put into vba or just what I specifically need?

  4. #4
    Registered User
    Join Date
    01-18-2013
    Location
    Baton Rouge, LA
    MS-Off Ver
    MS Office 2010
    Posts
    25

    Re: Printing a userform and displaying a chart upon finish VBA program

    jaslake, "keybd_event" is not recognized. When I use the help function, nothing comes up. Why?

  5. #5
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Printing a userform and displaying a chart upon finish VBA program

    Hi damayn83

    I can tell you how I've implemented this Code
    Please Login or Register  to view this content.
    The Code lives in the UserForm Module and is assigned to my OptionButton2. I click on the Button and it goes to print Preview. If you were to change this line of Code it'll go to the Printer
    Please Login or Register  to view this content.
    I do have these References set
    References.jpg

    And this is how the Final Product looks
    frmSummary.jpg

    Without seeing what you have and what you're trying to do, I can't implement it for you.

  6. #6
    Registered User
    Join Date
    01-18-2013
    Location
    Baton Rouge, LA
    MS-Off Ver
    MS Office 2010
    Posts
    25

    Re: Printing a userform and displaying a chart upon finish VBA program

    Okay, I need a print out button on my userform that is a click style. Think I have it.

  7. #7
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Printing a userform and displaying a chart upon finish VBA program

    Hi damayn83

    I'd think that should do it...let me know how you make out.

  8. #8
    Registered User
    Join Date
    01-18-2013
    Location
    Baton Rouge, LA
    MS-Off Ver
    MS Office 2010
    Posts
    25

    Re: Printing a userform and displaying a chart upon finish VBA program

    It is creating a new workbook and not printing the userform. I am still playing around with the code to get it to work correctly. Can I make your code print out specific worksheets that I have created?

  9. #9
    Registered User
    Join Date
    01-18-2013
    Location
    Baton Rouge, LA
    MS-Off Ver
    MS Office 2010
    Posts
    25

    Re: Printing a userform and displaying a chart upon finish VBA program

    I had to change your code a little bit once I figured out what it was doing. It now prints out the active worksheets in the workbook at end of program. Here is what it look like now. Thank you for all your help, could not have done it with out you.

    Please Login or Register  to view this content.

  10. #10
    Registered User
    Join Date
    01-18-2013
    Location
    Baton Rouge, LA
    MS-Off Ver
    MS Office 2010
    Posts
    25

    Re: Printing a userform and displaying a chart upon finish VBA program

    I had to change your code a little bit once I figured out what it was doing. It now prints out the active worksheets in the workbook at end of program. Here is what it look like now. Thank you for all your help, could not have done it with out you.

    Please Login or Register  to view this content.

  11. #11
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Printing a userform and displaying a chart upon finish VBA program

    Hi damayn83

    Good for you...glad you got it sorted. Glad I could help...you're welcome.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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