I prefer to use late-binding with VB6 and Catia. Although it is supposed to run slower, you'll find that it is Catia that runs slow and you won't notice the difference between early-binding and late-binding. If these terms are new to you they are covered in the VB docs, so you should read up on them.
The other advantage of late-binding is that you do not need to recompile code between Catia releases, unless the functionality that you are using has changed.
So, with late binding...
'In a module declaration section:
Global CATIA As Object
Then something like this:
Public Function GetCatia() As Boolean
GetCatia = False
If QUIT = False Then
If CATIA Is Nothing Then
On Error Resume Next
Set CATIA = GetObject(, "CATIA.Application")
If Err.Number <> 0 Then
msg = "Cannot find Catia. Please start Catia and then run the application."
msg = msg & vbCrLf & "Do you want to quit?"
res = MsgBox(msg, vbCritical + vbSystemModal + vbYesNo, "Cannot find Catia")
If res = vbYes Then
QUIT = True
End If
Else
GetCatia = True
End If
Else
GetCatia = True
End If
End If
End Function
If you want to use early binding you can find more information in the on-line documentation. See
V5Automation.chm in the bin directory of your Catia path for more information.
Andy