-
back to the start...
I am having trouble with this revision
It hangs at the last elseif. VB says I used an else without an if...
I italicised the parts I think pair up, unless I'm not reading it right?
Also, am I close on the msgbox?
[vba]
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Application.ScreenUpdating = False
Application.DisplayAlerts = False
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 .[A1000] = "Saved" Then
.[A1000].ClearContents
End If
'clean up
Set Sheet = Nothing
ActiveWorkbook.Save
ElseIf ActiveWorkbook.Saved = False Then MsgBox "Save changes? vbyesnocancel"
Application.ScreenUpdating = True
Application.DisplayAlerts = True
End With
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