Reputation: 12685
I have built an add-in that, apart for the code, is storing on its sheets some data that are functional to the add-in itself.
The user, through an user interface, can decide to remove some of the sheets from the add-in workbook, by selecting their names from a ListBox
object appearing on the user form that shows up when called on the workbook currently in use. So the idea is:
For j = 0 To MyListBox.ListCount - 1
If MyListBox.Selected(j) Then
sheetsToDelete.Add ws(j) 'where ws(j) is the sheet with that name
End If
Next j
The code above is not the real code, but just a sample to better express the concept. The real code works fine, I've tested in debug, but I just wanted to communicate the concept.
Once this is done, I would like to save the changes (i.e. the add-in after the sheets deletion) and so far I've done it with:
ThisWorkbook.Save
However, when this line of code is hit, "Excel application does not respond, the program will be terminated" (Excel workbook completely freezed):
I have checked in debug if the workbook is not corrupted, but it looks fine:
... it's my add-in...
... and it's containing the 2 sheets I expect it to contain:
Any tip on how to debug this? Unfortunately I cannot provide a full-reproduceable code snippet, I'm not being able..., but I might give more info if needed... anyone has encountered my some problem or can give me a nice tip?
Upvotes: 1
Views: 328
Reputation: 6105
There was another case where this was an issue. Not sure how this affects the .Save
:
ThisWorkbook.IsAddin = False
'Run Code Here
ThisWorkbook.IsAddin = True
Upvotes: 1