Backup Addin

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
 
B

Bob Phillips

Try savecopyas

Me.SaveCopyAs MyNew


--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)
 
R

Robin Clay

Thank you !
--
Regards

Robin


Bob Phillips said:
Try savecopyas

Me.SaveCopyAs MyNew


--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top