Below copy code for using:-
Note:- below highlight file name add ins (change file name)
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
' Display a Yes/No confirmation dialog
Dim response As VbMsgBoxResult
response = MsgBox("Do you want to Install/Upgrade add ons? if yes pls select overwrite change in prompt ", vbYesNo + vbQuestion, "Confirmation")
Application.DisplayAlerts = False
' Check the user's response
If response = vbYes Then
xlamFilePath = Application.UserLibraryPath & "Retail_Add_ons.xlam"
ActiveWorkbook.SaveAs xlamFilePath, FileFormat:=xlOpenXMLAddIn
Else
MsgBox "Not install only save file "
' Add your code to execute when the user clicks No or closes the dialog
End If
End Sub