PC Review


Reply
Thread Tools Rate Thread

2007: How to disable printing when a specific cell is blank

 
 
Aaron
Guest
Posts: n/a
 
      2nd Apr 2009
Hello,

I am trying to disable all printing when a specific cell on a worksheet is
blank. Meaning there is no way a user can print anything from the worksheet
until the cell has been filled.
Any code samples or examples would be both appreciated and helpful. This
example needs to work for Excel 2007, working for any other versions is a
bonus.

Thanks for the help in advance,
Aaron
 
Reply With Quote
 
 
 
 
Trevor Williams
Guest
Posts: n/a
 
      2nd Apr 2009
Hi Aaron

add this to your Workbook module

Private Sub Workbook_BeforePrint(Cancel As Boolean)
If Range("A1") = "" Then
MsgBox ("STOP")
Cancel = True
End If
End Sub

HTH
Trevor Williams

"Aaron" wrote:

> Hello,
>
> I am trying to disable all printing when a specific cell on a worksheet is
> blank. Meaning there is no way a user can print anything from the worksheet
> until the cell has been filled.
> Any code samples or examples would be both appreciated and helpful. This
> example needs to work for Excel 2007, working for any other versions is a
> bonus.
>
> Thanks for the help in advance,
> Aaron

 
Reply With Quote
 
Aaron
Guest
Posts: n/a
 
      2nd Apr 2009
Hey Trevor,

This worked well!
Thanks alot for the help.

Aaron

"Trevor Williams" wrote:

> Hi Aaron
>
> add this to your Workbook module
>
> Private Sub Workbook_BeforePrint(Cancel As Boolean)
> If Range("A1") = "" Then
> MsgBox ("STOP")
> Cancel = True
> End If
> End Sub
>
> HTH
> Trevor Williams
>
> "Aaron" wrote:
>
> > Hello,
> >
> > I am trying to disable all printing when a specific cell on a worksheet is
> > blank. Meaning there is no way a user can print anything from the worksheet
> > until the cell has been filled.
> > Any code samples or examples would be both appreciated and helpful. This
> > example needs to work for Excel 2007, working for any other versions is a
> > bonus.
> >
> > Thanks for the help in advance,
> > Aaron

 
Reply With Quote
 
Trevor Williams
Guest
Posts: n/a
 
      2nd Apr 2009
No worries.
Thanks for the feedback.

"Aaron" wrote:

> Hey Trevor,
>
> This worked well!
> Thanks alot for the help.
>
> Aaron
>
> "Trevor Williams" wrote:
>
> > Hi Aaron
> >
> > add this to your Workbook module
> >
> > Private Sub Workbook_BeforePrint(Cancel As Boolean)
> > If Range("A1") = "" Then
> > MsgBox ("STOP")
> > Cancel = True
> > End If
> > End Sub
> >
> > HTH
> > Trevor Williams
> >
> > "Aaron" wrote:
> >
> > > Hello,
> > >
> > > I am trying to disable all printing when a specific cell on a worksheet is
> > > blank. Meaning there is no way a user can print anything from the worksheet
> > > until the cell has been filled.
> > > Any code samples or examples would be both appreciated and helpful. This
> > > example needs to work for Excel 2007, working for any other versions is a
> > > bonus.
> > >
> > > Thanks for the help in advance,
> > > Aaron

 
Reply With Quote
 
Aaron
Guest
Posts: n/a
 
      2nd Apr 2009
However, I have one more question and Im not sure if this should be another
post or not... Would it be possible to do stop printing if the cell is blank
but still be able to view the print preview?

Thanks,
Aaron

"Trevor Williams" wrote:

> Hi Aaron
>
> add this to your Workbook module
>
> Private Sub Workbook_BeforePrint(Cancel As Boolean)
> If Range("A1") = "" Then
> MsgBox ("STOP")
> Cancel = True
> End If
> End Sub
>
> HTH
> Trevor Williams
>
> "Aaron" wrote:
>
> > Hello,
> >
> > I am trying to disable all printing when a specific cell on a worksheet is
> > blank. Meaning there is no way a user can print anything from the worksheet
> > until the cell has been filled.
> > Any code samples or examples would be both appreciated and helpful. This
> > example needs to work for Excel 2007, working for any other versions is a
> > bonus.
> >
> > Thanks for the help in advance,
> > Aaron

 
Reply With Quote
 
Trevor Williams
Guest
Posts: n/a
 
      2nd Apr 2009
Hmmm, that's a good question. Give me 5 mins and I'll try and suss it out.

"Aaron" wrote:

> However, I have one more question and Im not sure if this should be another
> post or not... Would it be possible to do stop printing if the cell is blank
> but still be able to view the print preview?
>
> Thanks,
> Aaron
>
> "Trevor Williams" wrote:
>
> > Hi Aaron
> >
> > add this to your Workbook module
> >
> > Private Sub Workbook_BeforePrint(Cancel As Boolean)
> > If Range("A1") = "" Then
> > MsgBox ("STOP")
> > Cancel = True
> > End If
> > End Sub
> >
> > HTH
> > Trevor Williams
> >
> > "Aaron" wrote:
> >
> > > Hello,
> > >
> > > I am trying to disable all printing when a specific cell on a worksheet is
> > > blank. Meaning there is no way a user can print anything from the worksheet
> > > until the cell has been filled.
> > > Any code samples or examples would be both appreciated and helpful. This
> > > example needs to work for Excel 2007, working for any other versions is a
> > > bonus.
> > >
> > > Thanks for the help in advance,
> > > Aaron

 
Reply With Quote
 
Trevor Williams
Guest
Posts: n/a
 
      2nd Apr 2009
Sorry Aaron - probably best to post it as a new question as it's not a 5 min
job (for me at least).

Should be possible though as just need to catch what event triggered the
beforeprint module. (printout or printpreview)

Trevor

"Aaron" wrote:

> However, I have one more question and Im not sure if this should be another
> post or not... Would it be possible to do stop printing if the cell is blank
> but still be able to view the print preview?
>
> Thanks,
> Aaron
>
> "Trevor Williams" wrote:
>
> > Hi Aaron
> >
> > add this to your Workbook module
> >
> > Private Sub Workbook_BeforePrint(Cancel As Boolean)
> > If Range("A1") = "" Then
> > MsgBox ("STOP")
> > Cancel = True
> > End If
> > End Sub
> >
> > HTH
> > Trevor Williams
> >
> > "Aaron" wrote:
> >
> > > Hello,
> > >
> > > I am trying to disable all printing when a specific cell on a worksheet is
> > > blank. Meaning there is no way a user can print anything from the worksheet
> > > until the cell has been filled.
> > > Any code samples or examples would be both appreciated and helpful. This
> > > example needs to work for Excel 2007, working for any other versions is a
> > > bonus.
> > >
> > > Thanks for the help in advance,
> > > Aaron

 
Reply With Quote
 
Aaron
Guest
Posts: n/a
 
      2nd Apr 2009
Ok, still I really appreciate the time, help and effort you have offered.
Thanks for that. I have reposted my question with the added print preview
requirement.

Thanks again!,
Aaron

"Trevor Williams" wrote:

> Sorry Aaron - probably best to post it as a new question as it's not a 5 min
> job (for me at least).
>
> Should be possible though as just need to catch what event triggered the
> beforeprint module. (printout or printpreview)
>
> Trevor
>
> "Aaron" wrote:
>
> > However, I have one more question and Im not sure if this should be another
> > post or not... Would it be possible to do stop printing if the cell is blank
> > but still be able to view the print preview?
> >
> > Thanks,
> > Aaron
> >
> > "Trevor Williams" wrote:
> >
> > > Hi Aaron
> > >
> > > add this to your Workbook module
> > >
> > > Private Sub Workbook_BeforePrint(Cancel As Boolean)
> > > If Range("A1") = "" Then
> > > MsgBox ("STOP")
> > > Cancel = True
> > > End If
> > > End Sub
> > >
> > > HTH
> > > Trevor Williams
> > >
> > > "Aaron" wrote:
> > >
> > > > Hello,
> > > >
> > > > I am trying to disable all printing when a specific cell on a worksheet is
> > > > blank. Meaning there is no way a user can print anything from the worksheet
> > > > until the cell has been filled.
> > > > Any code samples or examples would be both appreciated and helpful. This
> > > > example needs to work for Excel 2007, working for any other versions is a
> > > > bonus.
> > > >
> > > > Thanks for the help in advance,
> > > > Aaron

 
Reply With Quote
 
rebecca puck
Guest
Posts: n/a
 
      21st May 2009


Aaron and Trevor,

This is exactly what I am looking to do, however when looking at Aaron's
directions I am not sure where to input this information. I am also
using excel 2007. Can you point me in the right direction of where I
need to insert this information?

Thank you,
Rebecca

*** Sent via Developersdex http://www.developersdex.com ***
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Hide columns if specific cell is blank? smduello@gmail.com Microsoft Excel Misc 0 21st May 2008 05:29 PM
How to disable printing a specific worksheet? =?Utf-8?B?RWZ6ZWQ=?= Microsoft Excel Worksheet Functions 1 21st Feb 2007 05:43 PM
RE: How to disable printing a specific worksheet? =?Utf-8?B?V2lsbGlhbSBIb3J0b24=?= Microsoft Excel Worksheet Functions 0 21st Feb 2007 02:12 PM
DatagridView - Disable a combobox-cell in specific rows Klaus Jensen Microsoft Dot NET Framework Forms 2 15th Nov 2006 07:50 PM
Disable editing of one specific cell in one specific row in dataGr =?Utf-8?B?R2lkaQ==?= Microsoft C# .NET 1 28th Jan 2006 10:00 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:07 PM.