I pulled this code from another post.
I modified it to direct the user to enable macros on open,
and it hides sheets on close to stop the user from working if the macros are not enabled.
On close, even if I've saved my work, it asks to save the file.
I see that it does this because of the contents in [A1000] change if saved,
and that new change prompts the new save.
Will screenupdating and display alerts set to false allow the save without prompts and perform the file changes on close?
here is the code so far...
- thank you in advance -
[VBA]Private Sub Workbook_Open()
Dim Sheet As Worksheet
'make all sheets visible
For Each Sheet In Worksheets
If Sheet.Name <> "Prompt" Then
Sheet.Visible = xlSheetVisible
End If
Next Sheet
'hide the prompt and go to A1 on sheet1
Sheets("Prompt").Visible = xlSheetVeryHidden
'Application.GoTo Sheets("QCDetail").[A1], Scroll:=True
'clean up
Set Sheet = Nothing
ActiveWorkbook.Saved = True
End Sub
Private Sub Workbook_BeforeClose(Cancel As Boolean)
With Sheets("Prompt")
'if book is already saved, make a note of it
If ActiveWorkbook.Saved = True Then .[A1000] = "Saved"
'make prompt sheet visible
Dim Sheet As Worksheet
.Visible = xlSheetVisible
'hide all other sheets
For Each Sheet In Worksheets
If Sheet.Name <> "Prompt" Then
Sheet.Visible = xlSheetVeryHidden
End If
Next Sheet
'if the book is already saved, delete
'the previous note and close the book
If .[A100] = "Saved" Then
.[A1000].ClearContents
ActiveWorkbook.Save
End If
'clean up
Set Sheet = Nothing
End With
End Sub
[/VBA]