- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Forgive me, I am a total beginner at this vb.net thing. I have a vba routine that I have used for years to execute a lisp routine on an open document, then switch to the next already open document, and continue until the routine has been performed on each already open documents. For the life of me, I cannot figure out how in vb.net to get a document collection and make each document the active document so that I can execute the lisp routine.
VBA code:
=====================================================
Option Explicit
Dim objAcadApp As AcadApplication 'Acad application object
Dim objAcadDocs As AcadDocuments 'Acad documents collection
Dim objAcadDoc As AcadDocument 'Acad document object
Dim i As Integer
Public Sub FixAllIds()
'Get Acad objects
Set objAcadApp = GetObject(, "autoCAD.application") 'get Acad object
Set objAcadDocs = objAcadApp.Documents 'get Acad Documents collection
'step through open drawings
For i = 0 To (objAcadDocs.Count - 1)
'for each drawing run c:fix-id15
Set objAcadDoc = objAcadDocs.Item(i)
objAcadDoc.Activate
'load the routine
objAcadDoc.SendCommand "lo" & vbCr & "fix-id15" & vbCr
'run the routine
objAcadDoc.SendCommand "fix-id15" & vbCr
Next i
End Sub
=====================================================
Thanks in advance for any advice or pointers!
Solved! Go to Solution.