Page 1 of 1

Attachment with VB

Posted: Mon Aug 04, 2003 8:59 am
by jramey
Hello,

I am starting to develop an application with IntelliCAD Professional 3.3 that will use VB (not VBA). For starters, I need VB to attach to IntelliCAD. I configured VB to reference the IntelliCAD object model, and that seems to work fine. All of the objects, methods, and properties are appearing through Intellisense in VB.

I'm trying to get the following subroutine to work properly so that my VB application attaches to IntelliCAD. I can't get it to attach. I believe that the problem is in the syntax for the path statement. Here is the code snippet with the subroutine:

Public Sub Attaching()
On Error Resume Next
'Dim pathname As Text
Dim Application As IntelliCAD.Application
pathname = "c:\Program Files\CMS\IntelliCAD PE V3.3"
Set Application = GetObject(pathname, "IntelliCAD.Application")
If Err.Number <> 0 Then
Err.Clear
Set Application = CreateObject("IntelliCAD.Application")
If Err.Number Then
MsgBox "Unable to launch IntelliCAD session."
End
End If
End If
Dim ThisDocument As IntelliCAD.Document
Set ThisDocument = Application.ActiveDocument
Dim oLay As IntelliCAD.Layer
Set oLay = ThisDocument.ActiveLayer
Debug.Print oLay.Name
Debug.Print oLay.Color
End Sub

Posted: Tue Aug 05, 2003 8:56 pm
by John Finlay
jramey,

This takes me back in time!

Now this is just from memory -

Try ICAD.application for your GetObject and CreateObject.

For some reason the application name was set into the COM objects as ICAD and not IntelliCAD as you would think.

------------------
Regards
John Finlay