R
Robin Clay
Greetings !
I have this little routine in my AddIn, to save it on exit - Gord Dibben may
recognise this (for which, thanks again)
But as well as saving the AddIn, I would like to save a copy of it. But
this doesn't work....
-----------------
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Dim Msg, Ans, myDate, MyNew
With ActiveWorkbook
Msg = "Do You Want Save Changes to " _
& Me.Name & "?"
Ans = MsgBox(Msg, vbQuestion + vbYesNoCancel)
Select Case Ans
Case vbYes
Me.Save
myDate = Mid(Me.UserStatus(1, 2), 7, 4) _
& Mid(Me.UserStatus(1, 2), 4, 2) _
& Mid(Me.UserStatus(1, 2), 1, 2) _
& Mid(Me.UserStatus(1, 2), 12, 2) _
& Mid(Me.UserStatus(1, 2), 15, 2)
MyNew = Left(Me.Name, Len(Me.Name) - 4) _
& " " & myDate _
& ".xla"
FileCopy Me.Name = MyNew '<-------- doesn't work !
Case vbNo
Me.Saved = True
Case vbCancel
Cancel = True
Exit Sub
End Select
End With
End Sub
I have this little routine in my AddIn, to save it on exit - Gord Dibben may
recognise this (for which, thanks again)
But as well as saving the AddIn, I would like to save a copy of it. But
this doesn't work....
-----------------
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Dim Msg, Ans, myDate, MyNew
With ActiveWorkbook
Msg = "Do You Want Save Changes to " _
& Me.Name & "?"
Ans = MsgBox(Msg, vbQuestion + vbYesNoCancel)
Select Case Ans
Case vbYes
Me.Save
myDate = Mid(Me.UserStatus(1, 2), 7, 4) _
& Mid(Me.UserStatus(1, 2), 4, 2) _
& Mid(Me.UserStatus(1, 2), 1, 2) _
& Mid(Me.UserStatus(1, 2), 12, 2) _
& Mid(Me.UserStatus(1, 2), 15, 2)
MyNew = Left(Me.Name, Len(Me.Name) - 4) _
& " " & myDate _
& ".xla"
FileCopy Me.Name = MyNew '<-------- doesn't work !
Case vbNo
Me.Saved = True
Case vbCancel
Cancel = True
Exit Sub
End Select
End With
End Sub