+ Reply to Thread
Results 1 to 4 of 4

Private Sub Workbook_BeforePrint not working

  1. #1
    Registered User
    Join Date
    06-23-2007
    Posts
    41

    Private Sub Workbook_BeforePrint not working

    Hello,

    Trying to use following code in excel 2010:

    Please Login or Register  to view this content.
    I cannot get it functioning. Please guide me.
    If you are then:
    Useful links


    Enjoy, Duchbeer.

  2. #2
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Private Sub Workbook_BeforePrint not working

    You should dim "Sht" as worksheet and not object.

    Also this code will work only when you select MS-Office -> Print.
    Last edited by arlu1201; 01-30-2013 at 08:41 AM.
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

  3. #3
    Registered User
    Join Date
    06-23-2007
    Posts
    41

    Re: Private Sub Workbook_BeforePrint not working

    Thanks for your guidance. Changed code to:

    Please Login or Register  to view this content.
    Still does not work.

  4. #4
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Private Sub Workbook_BeforePrint not working

    When you say it does not work, what do you mean?

    How are you running the code? Trying to run it from the menu bar? Or on a button click?

+ 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