I have a little program that the user can issue several commands in all open drawings.
It has worked for years in AutoCAD versions 2006 through 2012.
I am testing our programs in AutoCAD 2015 before updating the Drafting Department.
After loading OpenDwgsCmds.lsp here is an example for using it.
Command: ODC
ZOOM E
END
The commands can even be an AutoLISP program you need to run in all open drawings such as MyCode or (c:MyCode) or (MyCode).
OpenDwgsCmd does not work in AutoCAD 2015 using the SendCommand in the VBA code.
A programmer with Autodesk helped me with the code by replacing "SendCommand" with "SendKeys" in the VBA code.
By replacing SendCommand with SendKeys the program will work,
but I have to toggle to each open drawing before it executes the commands.
I use Ctrl+Tab to toggle to each drawing, but that's not the way it's supposed to work.
In previous AutoCAD versions it executed the code automatically in all open drawings.
I have attached the code I am working with to see if someone can help me. To test OpenDwgsCmdsOriginal.dvb rename it to OpenDwgsCmds.dvb
Thank you,
TerryCadd a.k.a. Terry Miller
___________________________________________
OpenDwgsCmds.dvb Original Version with SendCommand
___________________________________________
Option Explicit
Sub Main()
Dim objDwg As AcadDocument
Dim objAcad As AcadApplication
Dim intDwgCnt As Integer
Dim strThisDwg As String
Dim intThisDwg As Integer
Set objAcad = AcadApplication.Application
intDwgCnt = 0
strThisDwg = ThisDrawing.FullName
For Each objDwg In objAcad.Documents
If objAcad.Documents.Item(intDwgCnt).FullName <> strThisDwg Then
objAcad.Documents.Item(intDwgCnt).Activate
objDwg.SendCommand "(load ""OpenDwgsCmds.lsp"")" & vbCr & "OpenDwgsCmds" & vbCr
Else
intThisDwg = intDwgCnt
End If
intDwgCnt = intDwgCnt + 1
Next objDwg
objAcad.Documents.Item(intThisDwg).Activate
ThisDrawing.SendCommand "(load ""OpenDwgsCmds.lsp"")" & vbCr & "OpenDwgsCmds" & vbCr
End Sub
_______________________________________
OpenDwgsCmds.dvb Revised Version with SendKeys
_______________________________________
Public Sub Main()
Dim initialDwg As AcadDocument
Set initialDwg = Application.ActiveDocument
initialDwg.SendCommand "(load ""OpenDwgsCmds.lsp"") OpenDwgsCmds "
Dim objDwg As AcadDocument
For Each objDwg In Application.Documents
If Not objDwg Is initialDwg Then
objDwg.Activate
DoEvents
SendKeys "{(}load ""OpenDwgsCmds.lsp""{)} OpenDwgsCmds ", True
DoEvents
End If
Next
initialDwg.Activate
End Sub