VB6 – “TYPE MISMATCH (ERROR CODE 13)” or “Invalid Use of New Keyword”

This error occurs if you incorrectly add the ActiveX component to your VB6 project.  Follow these rules:

1) If the ActiveX objects are dynamically created (they are not dragged and dropped onto a form from the palette), then add a Reference to the ActiveX.  You should NOT see the icons for the ActiveX in the palette.  Instances of the ActiveX objects are created by New statements in your code.

2) If the Chilkat ActiveX objects are dragged and dropped onto your form, then add the component via the “Project–>Components” menu, NOT the “Project–>References” menu.  In my opinion, it is always better to create instances of the objects dynamically because the Chilkat objects are not visual controls and won’t be visible on your form anyway at runtime.

3) Never do both — you should either add a Reference (Project–>References) or add the component to the palette (Project–>Components) but NEVER BOTH.