The following VBA code was submitted by Matt W in the AutoLISP thread:
"Execute commands on all open drawings".
It works great if the current drawing is the last in the list of open drawings, else it crashes.
I am not proficient in VBA, and need some help in modifying the VBA code to do the following:
1. Determine the iDwgCnt of the current drawing in the list of open drawings.
2. Skip over this iDwgCnt drawing in the For Each loop.
3. After the loop, execute the two skipped over lines on the current drawing.
Thanks in advance.
:ugly: Terry Cadd :loco:
Option Explicit
Public Const AppName = "VBA Thing-a-ma-jig"
Public Sub Main()
Dim oDwg As AcadDocument
Dim oAcad As AcadApplication
Dim iDwgCnt As Integer
Set oAcad = AcadApplication.Application
iDwgCnt = 0
For Each oDwg In oAcad.Documents
oAcad.Documents.Item(iDwgCnt).Activate
oDwg.SendCommand "(load ""VBA.lsp"")" & vbCr & "VBA" & vbCr
iDwgCnt = iDwgCnt + 1
Next oDwg
MsgBox "Done!", vbInformation + vbOKOnly, AppName
End Sub
;-----------------------------------------------------
(defun C:VBA ( / ); These commands may be customized as needed.
(command "tilemode" 1)
(command "zoom" "e")
(command "qsave")
(princ)
)