+ Reply to Thread
Results 1 to 14 of 14

how to enable print function ?

  1. #1
    Forum Contributor
    Join Date
    07-18-2006
    Posts
    135

    how to enable print function ?

    dear all,

    i put this code to thisworkbook to disable print function
    Please Login or Register  to view this content.
    now, i wanna click on command button to enable print fucntion as normal

    Thanks in advance

  2. #2
    Forum Expert dominicb's Avatar
    Join Date
    01-25-2005
    Location
    Lancashire, England
    MS-Off Ver
    MS Office 2000, 2003, 2007 & 2016 365
    Posts
    4,867

    Smile

    Good afternoon vumian

    Something like this should help :
    Please Login or Register  to view this content.
    HTH

    DominicB
    Please familiarise yourself with the rules before posting. You can find them here.

  3. #3
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229
    In normal module
    Please Login or Register  to view this content.
    In ThisWorkbook
    Please Login or Register  to view this content.
    _
    ...How to Cross-post politely...
    ..Wrap code by selecting the code and clicking the # or read this. Thank you.

  4. #4
    Forum Contributor
    Join Date
    07-18-2006
    Posts
    135
    hi all,

    cld you upload exampling file,

    Thank you very much

  5. #5
    Forum Contributor
    Join Date
    07-18-2006
    Posts
    135
    thanks all, i did successfully

  6. #6
    Forum Contributor
    Join Date
    07-18-2006
    Posts
    135

    Question

    dear all,

    i wanna allow the printPreview thro my code is putting workbook_beforeprint inside

    Thanks in advance

  7. #7
    Forum Expert dominicb's Avatar
    Join Date
    01-25-2005
    Location
    Lancashire, England
    MS-Off Ver
    MS Office 2000, 2003, 2007 & 2016 365
    Posts
    4,867

    Smile

    Hi vumian

    Quote Originally Posted by vumian
    i wanna allow the printPreview thro my code is putting workbook_beforeprint inside
    Not sure what you mean.
    Could you expand a little?

    DominicB

  8. #8
    Forum Contributor
    Join Date
    07-18-2006
    Posts
    135
    OK, follow this code

    Please Login or Register  to view this content.
    I wanna click on PrintPreView, i wanna the msgbox does not appear
    May it help you understand me

    Thanks in advance
    Last edited by vumian; 01-03-2008 at 09:30 AM.

  9. #9
    Forum Expert dominicb's Avatar
    Join Date
    01-25-2005
    Location
    Lancashire, England
    MS-Off Ver
    MS Office 2000, 2003, 2007 & 2016 365
    Posts
    4,867

    Smile

    Hi vumian

    Quote Originally Posted by vumian
    I wanna click on PrintPreView, but msgbox does not appear
    The code works fine for me when I Print Preview.
    Where have you put the code? It needs to go in the ThisWorkbook module - this is where you have put it isn't it?

    HTH

    DominicB

  10. #10
    Forum Contributor
    Join Date
    07-18-2006
    Posts
    135
    i wanna the msgbox does not appear

  11. #11
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229
    The Before_Print event occurs both with Print and PrintPreview. Code can't distinguish between them. This routine cancels both Print and PrintPreview and replaces them with the PrintPreview dialog. It can be controlled with the OKtoPrint variable in the same way as the Cancel both routine posted above.

    Please Login or Register  to view this content.

  12. #12
    Forum Contributor
    Join Date
    07-18-2006
    Posts
    135
    No solution to get that 2 buttons into 2 parts separate ?

  13. #13
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229
    Disabeling Excel's Print also disables PrintPreview.

    Rather than fiddling with the Before_Print event, you could disable both Excel's Print and PrintPreview and replace them with your own PrintPreview button and a (password protected?) Print.

    One other question, if Print is disabled, why would the user want to Preview the Print they can't do?

  14. #14
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229
    All three of these routines assume that this is in the ThisWorkbook code module.
    Please Login or Register  to view this content.
    Each of these routines can be assigned to a button from the Forms menu.

    togglePermission will only run when called by a command button. When permission is denied, neither normal Excel Print nor PrintPreview will work.

    myPreview will display a PrintPreview, regardless of the status of the permission.

    PrintWithPassword will print (if permission allows) or ask for a password to overide permission.

    This goes in a normal module.
    Please Login or Register  to view this content.

+ 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