Home |
Search |
Today's Posts |
#4
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
A saved workbook will have a path.
An unsaved workbook will not. Check for the path and Exit Sub if path is found. If not, carry on with message. Private Sub Workbook_Open() Dim MyBox As Object Dim Duration As Long If ActiveWorkbook.Path < "" Then Exit Sub Ttl = " Resave" Set MyBox = CreateObject("WScript.Shell") response = MyBox.PoPup(Msg, Duration, Ttl, vbOKCancel) End Sub On Sun, 27 Dec 2009 17:52:03 -0800, Phil wrote: Hi there, I've created a message that comes up upon opening a worksheet template i've created that reminds the user to resave this workbook first before using it so as not to loose the template. i've done this using the following code: Private Sub Workbook_Open() Dim MyBox As Object Dim Duration As Long Duration = 4 'Seconds Msg = "Resave this workbook first" Ttl = " Resave" Set MyBox = CreateObject("WScript.Shell") response = MyBox.PoPup(Msg, Duration, Ttl, vbOKCancel) End Sub The only problem is when i then open the resaved document. the message comes up everytime (obviously). What can i add to my code so that it only comes up the one time for that workbook but without loosing it so that it doesn't pop up in the future when i open the workbook for a new weekending. |