Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
I am not having any luck. It is letting me save the document with a false
value. The code I used: Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean) If Sheet1.CheckBox1.Value = False Then Cancel = True MsgBox "Save action cancelled" & vbCrLf & "You must check the checkbox before saving" End If Is that right? Sorry to be a pain! "BillyRogers" wrote: Press Alt+F11 and then on the left side of the screen should be the Project Exlporer that says "Project -VBAProject" at the top. If you don't see it, click view on the menu and select project explorer. There may be more than one project. Make sure you select the project with the same name as your workbook. If you click the plus sign to expand the project (it may already be expanded) you will see "Sheet1", "Sheet2", "Sheet3", and "This Workbook". Double Click where it says "This Workbook" and then past the code into the code window to the right and click the save button. Make sure actually have a checkbox on the worksheetand that it's named Checkbox1 Billy Rogers Dallas,TX Currently Using Office 2000 "Nikki" wrote: Thank you so much Billy. I thought I knew where the module was, but I guess I don't. Can you tell me? Thank you! "BillyRogers" wrote: Yes, here's an example with a checkbox named Checkbox1 Put this code in the ThisWorkbook module Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean) If Sheet1.CheckBox1.Value = False Then Cancel = True MsgBox "Save action cancelled" & vbCrLf & "You must check the checkbox before saving" End If End Sub If you don't know where the ThisWorkbook module is just reply to this post and I'll tell you how to get to it. -- Billy Rogers Dallas,TX Currently Using Office 2000 "Nikki" wrote: Is it possible to make a field (check box) required before saving a document? |
#2
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
I GOT IT!! Just had to add "end sub" Thank you so much! This will help us
tremendously! "Nikki" wrote: I am not having any luck. It is letting me save the document with a false value. The code I used: Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean) If Sheet1.CheckBox1.Value = False Then Cancel = True MsgBox "Save action cancelled" & vbCrLf & "You must check the checkbox before saving" End If Is that right? Sorry to be a pain! "BillyRogers" wrote: Press Alt+F11 and then on the left side of the screen should be the Project Exlporer that says "Project -VBAProject" at the top. If you don't see it, click view on the menu and select project explorer. There may be more than one project. Make sure you select the project with the same name as your workbook. If you click the plus sign to expand the project (it may already be expanded) you will see "Sheet1", "Sheet2", "Sheet3", and "This Workbook". Double Click where it says "This Workbook" and then past the code into the code window to the right and click the save button. Make sure actually have a checkbox on the worksheetand that it's named Checkbox1 Billy Rogers Dallas,TX Currently Using Office 2000 "Nikki" wrote: Thank you so much Billy. I thought I knew where the module was, but I guess I don't. Can you tell me? Thank you! "BillyRogers" wrote: Yes, here's an example with a checkbox named Checkbox1 Put this code in the ThisWorkbook module Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean) If Sheet1.CheckBox1.Value = False Then Cancel = True MsgBox "Save action cancelled" & vbCrLf & "You must check the checkbox before saving" End If End Sub If you don't know where the ThisWorkbook module is just reply to this post and I'll tell you how to get to it. -- Billy Rogers Dallas,TX Currently Using Office 2000 "Nikki" wrote: Is it possible to make a field (check box) required before saving a document? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Add "left align across selection" cell formatting | Excel Worksheet Functions | |||
Insert Picture from dropdown selection | New Users to Excel | |||
Max Value in a column exclude selection - Excel VBA | Excel Discussion (Misc queries) | |||
Cell Selection after "Enter" | Excel Discussion (Misc queries) | |||
limit cell list selection based on the selection of another list | Excel Worksheet Functions |