+ Reply to Thread
Results 1 to 11 of 11

Suppress Printing with VBA

  1. #1
    Registered User
    Join Date
    03-20-2009
    Location
    Manchester UK
    MS-Off Ver
    Excel 2003
    Posts
    7

    Suppress Printing with VBA

    Apologies for my error...thread edited as requested...:-

    As a newbie i thought i could overcome my little problem by research and trial and error but alas,,no i am stuck

    What i have is over 20 worksheets which have information on them that i want to print when selected so, i have a "main page" with a variety of options for the user to select (by check box) and when they are happy with their selection you would click another check box to print out, i have done this because the printer is set well away from the users and if they printed of sheet by sheet then lots of miles treading back and forth to the printer room would happen so, i thought by doing it this way it would batch print all selected sheets after selection, the code is set up to print all sheets which are selected by "true" in cell O2.

    This is no problem as it works well but the code also prints when the check box is de selected. What I would like is a message box to appear before the main macro runs for the user to select "yes or no" to confirm printing. I have put code in this for the command but it will not run the main magro if you select "yes"...below is the code for the main print loop...I think the code for print message should appear before this...think that is..?


    Please Login or Register  to view this content.
    Last edited by hooperman; 03-23-2009 at 06:01 AM.

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: Am doing this all wrong

    Please take a few minutes to read the forum rules about code tags and thread titles, and then edit your post accordingly.
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Registered User
    Join Date
    03-20-2009
    Location
    Manchester UK
    MS-Off Ver
    Excel 2003
    Posts
    7

    Re: Suppress Printing with VBA

    Sorry, is this presented correctly...?

  4. #4
    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 Re: Suppress Printing with VBA

    Good morning hooperman

    ...and welcome to the forum!!

    If I understand you correctly then soemthing like this should work OK :
    Please Login or Register  to view this content.
    HTH

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

  5. #5
    Registered User
    Join Date
    03-20-2009
    Location
    Manchester UK
    MS-Off Ver
    Excel 2003
    Posts
    7

    Re: Suppress Printing with VBA

    Dominic.

    Thanks for that, it works a treat....and after looking at the code i dunno how i missed the answer, probably because i have been looking at it too long..again, thanks all.

  6. #6
    Registered User
    Join Date
    03-20-2009
    Location
    Manchester UK
    MS-Off Ver
    Excel 2003
    Posts
    7

    Re: Suppress Printing with VBA

    As i mentioned in the last post the script works great and does everything that i wanted however, today there appears to be a slight problem.

    The file is going to be run from a shared Network drive and can be acessed by senior managers to run as and when needed, the problem i have noticed is that whilst it works ok on my workstation it does not work on anyother PC, the error coming back is

    Compile error "cannot find project or file"

    Any idea's

    Thanks in advance

  7. #7
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Suppress Printing with VBA

    On one of the PCs on which it fails you need to go to the VBE and check References - look for libraries listed as MISSING... it could be a Calendar control for ex. or it could be that your Office version is different to theirs (?) ... report back with results.

  8. #8
    Registered User
    Join Date
    03-20-2009
    Location
    Manchester UK
    MS-Off Ver
    Excel 2003
    Posts
    7

    Re: Suppress Printing with VBA

    Just gone into VBE (Alt F11) and looked at libraries, cannot see anything unusual, all workstations have the same version of excel as well...?

  9. #9
    Registered User
    Join Date
    03-20-2009
    Location
    Manchester UK
    MS-Off Ver
    Excel 2003
    Posts
    7

    Re: Suppress Printing with VBA

    For reference, the macro reports the error at this line

    And LCase(Sh.Range("O2").Text) = LCase("True") Then

  10. #10
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Suppress Printing with VBA

    Quote Originally Posted by hooperman View Post
    Just gone into VBE (Alt F11) and looked at libraries, cannot see anything unusual...
    On the machine on which a debug is generated ?
    If so I have nothing to add I'm afraid.

  11. #11
    Registered User
    Join Date
    03-20-2009
    Location
    Manchester UK
    MS-Off Ver
    Excel 2003
    Posts
    7

    Re: Suppress Printing with VBA

    Would anyone else have any suggestions,,,?? I really need this to work on any workstation, cannot understand why it cannot be done..


    Done it..... Was errors as you said...was just me, could not find them...thanks for your help
    Last edited by hooperman; 04-01-2009 at 08:17 AM.

+ 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