PRB: Public Identifiers in Type Libraries May Not Have Leading Underscores in VBA (244045)



The information in this article applies to:

  • Microsoft Visual Basic for Applications (VBA) Software Development Kit (SDK) 5.0
  • Microsoft Visual Basic for Applications (VBA) Software Development Kit (SDK) 6.0
  • Microsoft Visual Basic for Applications (VBA) Software Development Kit (SDK) 6.1

This article was previously published under Q244045

SYMPTOMS

If the type information of an ActiveX Control contains public identifiers with leading underscores, and that control is added to a VBA-enabled application, Visual Basic for Applications (VBA) macros might not run or VBA might crash.

For example, the following enumeration in a control's type library may cause problems:
typedef enum _Names{
	Bob,
	John,
	Sally
} Names;
				

CAUSE

This problem occurs because leading underscores in VBA have special meaning.

RESOLUTION

To correct this problem, all underscores in the type library of the control should be removed. For example, the previous enumeration can be changed to the following:
typedef enum tagNames{
	Bob,
	John,
	Sally
} Names;
				

STATUS

This behavior is by design.

Modification Type:MajorLast Reviewed:11/19/1999
Keywords:kbprb KB244045