R
Rod Plastow
Some of you probably know this already but I thought I would share this since
it may save other some debugging time and head-scratching.
It concerns legitimate names for methods and procedures in an interface
class - that is a class that will be used as the source for inheritance. The
basic rule is: Don't use underscores. I have seen this documented nowhere and
the symptoms if you do use underscores don't readily lead you to the cause of
the problem.
For ordinary classes and modules underscores cause no problem and can
visually aid the readibility of the code. VBA itself liberally uses
underscores when constructing procedure names. When used for procedure names
of a class that will be used as an interface class there is no warning and
the names are accepted (after all VBA does not know this is an interface
class at this stage).
The troubles begin when you specify another class and use the Implements
keyword. The symptom is that although the parent interface class is shown in
the drop-down Object list of the VBA coding window the IDE drop-down list
does not show all the properties and methods of the parent interface class.
Furthermore the Object list reverts to ‘(General)’ - probably symptoms of
one and the same condition. Repeatedly selecting the interface class from
the Object list results in multiple copies of the same property or method
being pasted into the code pane. No warning or error is generated.
Underscores are also illegal for user event but here the VBA parser warns
you instantly.
Rod
it may save other some debugging time and head-scratching.
It concerns legitimate names for methods and procedures in an interface
class - that is a class that will be used as the source for inheritance. The
basic rule is: Don't use underscores. I have seen this documented nowhere and
the symptoms if you do use underscores don't readily lead you to the cause of
the problem.
For ordinary classes and modules underscores cause no problem and can
visually aid the readibility of the code. VBA itself liberally uses
underscores when constructing procedure names. When used for procedure names
of a class that will be used as an interface class there is no warning and
the names are accepted (after all VBA does not know this is an interface
class at this stage).
The troubles begin when you specify another class and use the Implements
keyword. The symptom is that although the parent interface class is shown in
the drop-down Object list of the VBA coding window the IDE drop-down list
does not show all the properties and methods of the parent interface class.
Furthermore the Object list reverts to ‘(General)’ - probably symptoms of
one and the same condition. Repeatedly selecting the interface class from
the Object list results in multiple copies of the same property or method
being pasted into the code pane. No warning or error is generated.
Underscores are also illegal for user event but here the VBA parser warns
you instantly.
Rod