Browse DevX
Sign up for e-mail newsletters from DevX

Tip of the Day
Language: Visual Basic
Expertise: Intermediate
Oct 22, 1999



Building the Right Environment to Support AI, Machine Learning and Deep Learning

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 Function
	' 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.
Kelley L.
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date