PDA

View Full Version : [SOLVED:] Prompt windows on Save



newk
09-07-2005, 03:04 AM
Hi everyone,

Can someone tell me how to create a 'prompt window' that will display 'on save' in Excel.

I just want a window box to say,


'Please ensure that you have completed ...'

When you try to 'save' or 'saveas' a file.

Any help would be gratefully appreciated

Thank you

Kieran

Killian
09-07-2005, 03:56 AM
So you'll need to use the workbook's BeforeSave event
In the VBE, double-click the Workbook from Microsoft Excel Object and from the dropdowns above the code pane, select workbook(left) and BeforeSave (right).
Then you can modify it to run a message box that cancels the save on cancel


Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
Const strPrompt As String = "Please ensure that you have completed ..."
If MsgBox(strPrompt, vbOKCancel, "Confirm save") = vbCancel Then
Cancel = True
End If
End Sub

newk
09-07-2005, 04:17 AM
Killian you dude, thats excellent.

Thank you

Kieran

Killian
09-07-2005, 04:34 AM
no problem

I've marked the thread as solved