I\'ve code which, when I press a button, will add a new sheet to a workbook and change the codename of the sheet to make it easier to refer to later in my code.
Another simple method to force refreshing of the VBComponents Collection:
PropertyGetDiscard ThisWorkbook.VBProject.VBComponents.Count
Private Sub PropertyGetDiscard(AnyPropertyGet): End Sub
The procedure PropertyGetDiscard
is used to avoid polluting the Immediate window or using a superfluous variable