devxlogo

ActiveX Can’t Create Which Object?

ActiveX Can’t Create Which Object?

When working on a large VB application that uses hundreds of COM objects, the “429 can’t create object” error doesn’t give you much help in determining which object could not be created. You can get around this limitation by writing a function to wrap the VB runtime CreateObject function:

 Public Function CreateObject(sProgID as string) _	as object	On Error Goto CreateErr	' Call the VB runtime CreateObject function	Set CreateObject = VBA.CreateObject(sProgId)	Exit FunctionCreateErr:	' return the error with the name of the object 	'that could not be created	Err.Raise Err.Number, _		"CreateObject Wrapper", Err.Description & _		": '" & sProgID & "'"End Function

With this wrapper function, you get the 429 error and the name of the object that could not be created.

devx-admin

Share the Post: