ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   2007: How to disable printing when a specific cell is blank (https://www.excelbanter.com/excel-programming/426396-2007-how-disable-printing-when-specific-cell-blank.html)

Aaron

2007: How to disable printing when a specific cell is blank
 
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

Trevor Williams

2007: How to disable printing when a specific cell is blank
 
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


Aaron

2007: How to disable printing when a specific cell is blank
 
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


Trevor Williams

2007: How to disable printing when a specific cell is blank
 
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


Aaron

2007: How to disable printing when a specific cell is blank
 
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


Trevor Williams

2007: How to disable printing when a specific cell is blank
 
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


Trevor Williams

2007: How to disable printing when a specific cell is blank
 
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


Aaron

2007: How to disable printing when a specific cell is blank
 
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


rebecca puck

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


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 ***


All times are GMT +1. The time now is 11:56 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com