Consulting

Results 1 to 6 of 6

Thread: Macro To Not Allow Printing When Specific Fields Are Left Blank

  1. #1

    Macro To Not Allow Printing When Specific Fields Are Left Blank

    Hi, can someone please help me create a macro on my file. I want the user to not be able to print the file unless he has filled-out the fields I have tagged in red font. I want an error message to prompt user that the required fields should be populated first before printing. Thanks!
    Last edited by rachell_8; 09-16-2010 at 02:15 AM.

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    I have done a couple for you, I will leave the rest to you
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  3. #3
    Perfect XLD!!! Thanks a lot for the help. You're the BEST!!! =D

  4. #4

  5. #5
    Hey

    In your WorkBook object, add the following code:

    [VBA]
    Private Sub Workbook_BeforePrint(Cancel As Boolean)
    If [SetOfConditions] Then
    Cancel = False
    Else
    MsgBox 'Sorry, you cannot print at the moment.'
    Cancel = True
    End If
    End Sub
    [/VBA]

    Add the set of conditions you want to exist for the user to be able to print, in [SetOfConditions]. As long as these conditions are not met, printing will be disabled.

    Hope this helped...
    NormalAnomaly

  6. #6
    Thanks NormalAnomaly!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •