Performance implications of adding events to classes in VBA
Posted on 2012-09-16
As part of several Excel/Access/VBA automation projects I'm currently involved in, I'm creating some generic reusable classes with different functionality.
In some of these it seems convenient to add some events for different state changes. However some of these objects need to handle very large amounts of data very quickly, so I'm trying to optimize performance in every part of the code I'm doing, and this raised the following questions regarding events:
1. What is the performance implication of adding event raisers to procedures? In some procedures RaiseEvent will potentially be called very often, so this is important.
2. If the class is declared without the WithEvents keyword is the RaiseEvent lines then completely ignored and will not have any perfect on performance at all?