-
Not sure how to avoid prompt
I'm still learning VBA and I'm not confident about everything that happens in the code. I don't know if the "saved" line helps a step in the process.
I pulled out what I don't think I need, but I'm not sure how to avoid the save prompt if they have already saved.
I am hidding sheets, and that change prompts for a save.
I hid screen updating and display alerts but not sure what I'm missing...
[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 sheet
Sheets("Prompt").Visible = xlSheetVeryHidden
'clean up
Set Sheet = Nothing
' ActiveWorkbook.Saved = True
End Sub
Private Sub Workbook_BeforeClose(Cancel As Boolean)
With Sheets("Prompt")
Application.ScreenUpdating = False
Application.DisplayAlerts = False
'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
Set Sheet = Nothing
End With
Application.ScreenUpdating = True
Application.DisplayAlerts = True
End Sub
[/VBA]
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules