I have a VB app that looks at autocad to determine if a dwg is open. I have run into a problem if the user has more than one instance of Autocad running or if the dwg that is open still has an open command running such as Pan. This throws up a message and has an adverse affect on my app. With all that my question would be how do I loop through all the instances of Autocad. This is my code to loop through the dwg files to determine if it is open. If it is a message will inform them to save and close the file before my app can "Check the file in" or back to the server. Wasn't sure where to post this. Oh and I also need to pass either a Ctrl+C or an Escape character to each file to terminate any active commands.
Public Function AcadLink() As Boolean
Dim h, i As Integer
Dim DwgName As String
i = 0
AcadLink = False
On Error GoTo nocad
Set AcadApp = GetObject(, "AutoCAD.Application")
For i = 0 To AcadApp.Documents.Count - 1
DwgName = Left(Right(AcadApp.Documents(i).Name, Len(lstCitem) + 4), Len(lstCitem))
If lstCitem = DwgName Then
AcadLink = True
Exit For
End If
Next i
nocad:
End Function
Thanks
Public Function AcadLink() As Boolean
Dim h, i As Integer
Dim DwgName As String
i = 0
AcadLink = False
On Error GoTo nocad
Set AcadApp = GetObject(, "AutoCAD.Application")
For i = 0 To AcadApp.Documents.Count - 1
DwgName = Left(Right(AcadApp.Documents(i).Name, Len(lstCitem) + 4), Len(lstCitem))
If lstCitem = DwgName Then
AcadLink = True
Exit For
End If
Next i
nocad:
End Function
Thanks