+ Reply to Thread
Results 1 to 15 of 15

EXCEL USERFORM- Unable to print spreadsheet using command button

  1. #1
    Registered User
    Join Date
    04-03-2013
    Location
    USA
    MS-Off Ver
    Excel 2003
    Posts
    78

    EXCEL USERFORM- Unable to print spreadsheet using command button

    For some reason when the cmdPrint is depressed and the date range is choosen nothing prints. Don't know what is missing in the code. I have attached my workbook.

  2. #2
    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: EXCEL USERFORM- Unable to print spreadsheet using command button

    Hello PANTECH,

    The problem I see is there is no code behind the cmdPrint button. Did you post the most version of the workbook?
    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!)

  3. #3
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: EXCEL USERFORM- Unable to print spreadsheet using command button

    You didn't copy the code for cmdPrint on the main form and you've removed the code to actually print from cmdPrint on frmPrint.
    If posting code please use code tags, see here.

  4. #4
    Registered User
    Join Date
    04-03-2013
    Location
    USA
    MS-Off Ver
    Excel 2003
    Posts
    78

    Re: EXCEL USERFORM- Unable to print spreadsheet using command button

    That is the latest worksheet all the code is under frmPrint.

    Added 'Application.PrintCommunication = False

    'Application.PrintCommunication =True

    Now date range doesn't work. Attached is current workbook
    Last edited by PANTECH; 04-18-2013 at 02:23 PM.

  5. #5
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: EXCEL USERFORM- Unable to print spreadsheet using command button

    The code to do the actual printing is still missing.

    It was commented out in the original code for the reason I said in the other thread and Application.PrinterCommunication was commented out because it's not
    available in Excel 2003.

  6. #6
    Registered User
    Join Date
    04-03-2013
    Location
    USA
    MS-Off Ver
    Excel 2003
    Posts
    78

    Re: EXCEL USERFORM- Unable to print spreadsheet using command button

    So what (in detail) needs to been done to make this print?

  7. #7
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: EXCEL USERFORM- Unable to print spreadsheet using command button

    Uncomment the PrintOut line in this, the original, code.
    Please Login or Register  to view this content.
    PS Why didn't you continue in the original thread?

  8. #8
    Registered User
    Join Date
    04-03-2013
    Location
    USA
    MS-Off Ver
    Excel 2003
    Posts
    78

    Re: EXCEL USERFORM- Unable to print spreadsheet using command button

    Please take another look, when I press print I now longer get the pop up for the date range. Now that worked yesterday but printing still is not working. The latest workbook is attached. Really appreciate the help. You'll get 5 gold stars if you can make this work!

  9. #9
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: EXCEL USERFORM- Unable to print spreadsheet using command button

    Still no code to open the print form.

    In design view double click the Print button.

    You'll now see this.
    Please Login or Register  to view this content.
    This is where you need to put the code to open the userform.

    For example, this, the original code.
    Please Login or Register  to view this content.

  10. #10
    Registered User
    Join Date
    04-03-2013
    Location
    USA
    MS-Off Ver
    Excel 2003
    Posts
    78

    Re: EXCEL USERFORM- Unable to print spreadsheet using command button

    I followed your instructions, now getting Run-time error '400': Form already displayed; can't show modally. When I click on debug it takes me to the code line frmPrint.Show this line is in yellow. What did I miss, attached current workbook.

  11. #11
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: EXCEL USERFORM- Unable to print spreadsheet using command button

    Why do you have this code in the cmdPrint click event on frmPrint?
    Please Login or Register  to view this content.
    It only goes in the cmdPrint click event on the main form, frmINVENTORY.

  12. #12
    Registered User
    Join Date
    04-03-2013
    Location
    USA
    MS-Off Ver
    Excel 2003
    Posts
    78

    Re: EXCEL USERFORM- Unable to print spreadsheet using command button

    Made corrections to code frmPrint.Show to cmdPrint.Show. Now I get complie error: Method or data member not found. Remember I am not a professional programmer. Just messing with VBA, this is mine first userform. This is all new to me!

  13. #13
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: EXCEL USERFORM- Unable to print spreadsheet using command button

    Remove the highlighted code from here.
    Please Login or Register  to view this content.

  14. #14
    Registered User
    Join Date
    04-03-2013
    Location
    USA
    MS-Off Ver
    Excel 2003
    Posts
    78

    Re: EXCEL USERFORM- Unable to print spreadsheet using command button

    Now getting Run-time error '438' Object doesn't support this property or method. Below is hilighted.

    .Print Copies:=1

  15. #15
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: EXCEL USERFORM- Unable to print spreadsheet using command button

    Why did you change PrintOut, which was in the original code, to Print?

+ 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