Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
fill in cell before printing / saving
I have looked at previous posts and the codes given have not worked.
Is there a way to stop a user from printing an excel sheet before filling in specific areas? If not I need help with the code associated with not saving before filling it out. Help? -- Karissa |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
fill in cell before printing / saving
Place this subroutine in a workbook module (not a general module)
Private Sub Workbook_BeforePrint(Cancel As Boolean) If Range("Sheet3!C10") = "" Then Cancel = True MsgBox "No tax value entered into C10" End If End Sub best wishes -- Bernard V Liengme Microsoft Excel MVP http://people.stfx.ca/bliengme remove caps from email "Karissa" wrote in message ... I have looked at previous posts and the codes given have not worked. Is there a way to stop a user from printing an excel sheet before filling in specific areas? If not I need help with the code associated with not saving before filling it out. Help? -- Karissa |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
fill in cell before printing / saving
Ok, so this may be one of my issues: I am not sure the difference between
workbook module and general module. I have been putting the code in "This workbook" and nothing happens. Any guidance? -- Karissa "Bernard Liengme" wrote: Place this subroutine in a workbook module (not a general module) Private Sub Workbook_BeforePrint(Cancel As Boolean) If Range("Sheet3!C10") = "" Then Cancel = True MsgBox "No tax value entered into C10" End If End Sub best wishes -- Bernard V Liengme Microsoft Excel MVP http://people.stfx.ca/bliengme remove caps from email "Karissa" wrote in message ... I have looked at previous posts and the codes given have not worked. Is there a way to stop a user from printing an excel sheet before filling in specific areas? If not I need help with the code associated with not saving before filling it out. Help? -- Karissa |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
fill in cell before printing / saving
You have the right module. What version of Excel are you using? What is
your macro security setting? Are you opening the file with macros enabled? Are you sure that you had the ThisWorkbook module on the screen when you pasted the macro into it? You must double-click "ThisWorkbook" to access that module. HTH Otto "Karissa" wrote in message ... Ok, so this may be one of my issues: I am not sure the difference between workbook module and general module. I have been putting the code in "This workbook" and nothing happens. Any guidance? -- Karissa "Bernard Liengme" wrote: Place this subroutine in a workbook module (not a general module) Private Sub Workbook_BeforePrint(Cancel As Boolean) If Range("Sheet3!C10") = "" Then Cancel = True MsgBox "No tax value entered into C10" End If End Sub best wishes -- Bernard V Liengme Microsoft Excel MVP http://people.stfx.ca/bliengme remove caps from email "Karissa" wrote in message ... I have looked at previous posts and the codes given have not worked. Is there a way to stop a user from printing an excel sheet before filling in specific areas? If not I need help with the code associated with not saving before filling it out. Help? -- Karissa |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
fill in cell before printing / saving
Right-click on the Excel Icon left of "File" or left end of Title Bar if
sheet window not maximized, Select "View Code" and paste the code into that module............which is Thisworkbook module. Alt + q to return to Excel window. Hit Print button. If the range is empty or a formula returns "" the code should cancel the print job and pop up the msgbox. Gord Dibben MS Excel MVP On Mon, 8 Dec 2008 12:39:00 -0800, Karissa wrote: Ok, so this may be one of my issues: I am not sure the difference between workbook module and general module. I have been putting the code in "This workbook" and nothing happens. Any guidance? -- Karissa "Bernard Liengme" wrote: Place this subroutine in a workbook module (not a general module) Private Sub Workbook_BeforePrint(Cancel As Boolean) If Range("Sheet3!C10") = "" Then Cancel = True MsgBox "No tax value entered into C10" End If End Sub best wishes |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
fill in cell before printing / saving
I am using excel 2003 its on medium security I keep getting a run time error : run time error'1004':method 'range'of object_Global'failed. otherwise all I did was cut and paste this code just to test it for sheet3: Private Sub Workbook_BeforePrint(Cancel As Boolean) If Range("Sheet3!C10") = "" Then Cancel = True MsgBox "No tax value entered into C10" End If End Sub I appreciate your help -- Karissa "Gord Dibben" wrote: Right-click on the Excel Icon left of "File" or left end of Title Bar if sheet window not maximized, Select "View Code" and paste the code into that module............which is Thisworkbook module. Alt + q to return to Excel window. Hit Print button. If the range is empty or a formula returns "" the code should cancel the print job and pop up the msgbox. Gord Dibben MS Excel MVP On Mon, 8 Dec 2008 12:39:00 -0800, Karissa wrote: Ok, so this may be one of my issues: I am not sure the difference between workbook module and general module. I have been putting the code in "This workbook" and nothing happens. Any guidance? -- Karissa "Bernard Liengme" wrote: Place this subroutine in a workbook module (not a general module) Private Sub Workbook_BeforePrint(Cancel As Boolean) If Range("Sheet3!C10") = "" Then Cancel = True MsgBox "No tax value entered into C10" End If End Sub best wishes |
#7
Posted to microsoft.public.excel.programming
|
|||
|
|||
fill in cell before printing / saving
I figured it out...spaced the fact that I named the tabs and it was no longer sheet3 dumb user mistake. Thank you for your help!! -- Karissa "Gord Dibben" wrote: Right-click on the Excel Icon left of "File" or left end of Title Bar if sheet window not maximized, Select "View Code" and paste the code into that module............which is Thisworkbook module. Alt + q to return to Excel window. Hit Print button. If the range is empty or a formula returns "" the code should cancel the print job and pop up the msgbox. Gord Dibben MS Excel MVP On Mon, 8 Dec 2008 12:39:00 -0800, Karissa wrote: Ok, so this may be one of my issues: I am not sure the difference between workbook module and general module. I have been putting the code in "This workbook" and nothing happens. Any guidance? -- Karissa "Bernard Liengme" wrote: Place this subroutine in a workbook module (not a general module) Private Sub Workbook_BeforePrint(Cancel As Boolean) If Range("Sheet3!C10") = "" Then Cancel = True MsgBox "No tax value entered into C10" End If End Sub best wishes |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Saving as PDF and printing in a macro | Excel Programming | |||
Printing and saving problems | Excel Discussion (Misc queries) | |||
How do I force a user to fill in all cells in excel before saving | Excel Discussion (Misc queries) | |||
Excel printing problem - won't print cell under a "fill effect" bo | Excel Discussion (Misc queries) | |||
Printing and saving file. | Excel Programming |