Reputation: 504
I am showing an add-in, copying a worksheet to the active workbook, then hiding the add-in again. This works as it should, but the user gets a prompt asking if they want to save changes to the add-in when the Excel workbook is closed. How can I modify this syntax so that the add-in will always be closed with no prompt to save changes?
Dim wbName As String
wbName = ActiveWorkbook.Name
ThisWorkbook.IsAddin = False
Dim LookupWB As Workbook: Set LookupWB = Application.Workbooks("URZ.xlam")
Sheets("Green").Select
ActiveSheet.Copy Before:=Workbooks(wbName).Sheets(1)
LookupWB.IsAddin = True
Upvotes: 1
Views: 594
Reputation: 3322
You can add this line: LookupWB.Saved = True
But i don't think you need to show the add-in and then hide it.
Try this code:
Sub test()
Dim Wb As Workbook: Set Wb = ActiveWorkbook
Dim LookupWB As Workbook: Set LookupWB = Application.Workbooks("URZ.xlam")
LookupWB.Sheets("Green").Copy Before:=Wb.Sheets(1)
End Sub
Upvotes: 3