Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Nikki
 
Posts: n/a
Default Required selection

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   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Nikki
 
Posts: n/a
Default Required selection

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Add "left align across selection" cell formatting Monty Analyst Excel Worksheet Functions 2 November 5th 08 03:17 PM
Insert Picture from dropdown selection Mike at Channel New Users to Excel 21 March 22nd 06 01:14 AM
Max Value in a column exclude selection - Excel VBA magix Excel Discussion (Misc queries) 3 November 5th 05 09:18 PM
Cell Selection after "Enter" Synectica Excel Discussion (Misc queries) 6 August 29th 05 09:55 PM
limit cell list selection based on the selection of another list lorraine Excel Worksheet Functions 2 December 14th 04 08:17 PM


All times are GMT +1. The time now is 01:54 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"