Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() I am trying to create a spread sheet that would require a person to fill in certain fields before they could print a worksheet. Is this possible? -- tiab86 ------------------------------------------------------------------------ tiab86's Profile: http://www.excelforum.com/member.php...o&userid=25628 View this thread: http://www.excelforum.com/showthread...hreadid=530950 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Put the following code in the ThisWorkbook module
Private Sub Workbook_BeforePrint(Cancel As Boolean) If Worksheets("Sheet1").Range("A1") = "" Then '<<< change as required Cancel = True End If End Sub Change the worksheet name and cell reference to the appropriate values. -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "tiab86" wrote in message ... I am trying to create a spread sheet that would require a person to fill in certain fields before they could print a worksheet. Is this possible? -- tiab86 ------------------------------------------------------------------------ tiab86's Profile: http://www.excelforum.com/member.php...o&userid=25628 View this thread: http://www.excelforum.com/showthread...hreadid=530950 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Use the beforeprint event to check
If they are not filled in, then display a msgbox and set the cancel variable to True. http://www.cpearson.com/excel/events.htm for an overview of events. -- Regards, Tom Ogilvy "tiab86" wrote: I am trying to create a spread sheet that would require a person to fill in certain fields before they could print a worksheet. Is this possible? -- tiab86 ------------------------------------------------------------------------ tiab86's Profile: http://www.excelforum.com/member.php...o&userid=25628 View this thread: http://www.excelforum.com/showthread...hreadid=530950 |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Ok, I'm a bit confused. When I put the values in below it appears to do nothing. I'm new to VB so that's probably part of my problem. What am I doing wrong? I get the following error: Run-time error '438': Object doesn't support this property or method Private Sub Workbook_BeforePrint(Cancel As Boolean) If Worksheets("Packing Slip").Range("U10") = "" Then ' Cancel = True End If End Sub -- tiab86 ------------------------------------------------------------------------ tiab86's Profile: http://www.excelforum.com/member.php...o&userid=25628 View this thread: http://www.excelforum.com/showthread...hreadid=530950 |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Private Sub Workbook_BeforePrint(Cancel As Boolean)
If Worksheets("Packing Slip").Range("U10") = "" Then ' Cancel = True End If End Sub You have already hit the print button, so you don't need to do anything for it to print. What you are doing is cancelling that print if U10 of Packing Slip is blank. Immediately after Cancel=True you might want to put in Msgbox "Printing cancelled until you put a value in U10" -- Regards, Tom Ogilvy "tiab86" wrote: Ok, I'm a bit confused. When I put the values in below it appears to do nothing. I'm new to VB so that's probably part of my problem. What am I doing wrong? I get the following error: Run-time error '438': Object doesn't support this property or method Private Sub Workbook_BeforePrint(Cancel As Boolean) If Worksheets("Packing Slip").Range("U10") = "" Then ' Cancel = True End If End Sub -- tiab86 ------------------------------------------------------------------------ tiab86's Profile: http://www.excelforum.com/member.php...o&userid=25628 View this thread: http://www.excelforum.com/showthread...hreadid=530950 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
can I make a field in excel spreadsheet required? If yes, How? | Excel Discussion (Misc queries) | |||
Required Field | Excel Worksheet Functions | |||
Drop down - required field | Excel Programming | |||
Required field message - Excel | Excel Discussion (Misc queries) | |||
Field Required if another field is checked | Excel Programming |