Warning message on file close
You would need an event macro to be placed in the ThisWorkbook code module:
Something like (untested):
Private Sub Workbook_BeforeClose(Cancel As Boolean)
If MsgBox("Do you want to run the XXX macro?", _
vbYesNo + vbQuestion, "Reminder!") = vbYes Then
Cancel = True
XXX
End If
End Sub
where "XXX" is the name of the macro.
This is plain vanilla; you could add error-handling, testing whether the
macro has already been run, etc.
--
Vasant
"Lambtwo" wrote in message
news:O1f7f.297503$tl2.119111@pd7tw3no...
My program has a macro that should normally be executed before the user
closes the file. The macro transfers data to a destination file, but there
are times where the user forgets or neglects to run it.
I would like to have a warning message display only when the user attempts
to close the file and the macro has not been run. I don't want to go as
far as forcing the macro as there are times when the file is opened and
worked on and then may be aborted for a legit reason.
Any suggestions?
|