How can I do to load a macro with events automatically? I maked a macro with beginsave event and this one only works if I write the code into AutoCAD Object folder in the IDE. This is the code: Private Sub AcadDocument_BeginSave(ByVal FileName As String) Call AutoDWF MsgBox "O DWF has create successful! " End Sub Public Sub AutoDWF() Dim objPlot As Object Set objPlot = ThisDrawing.Plot Dim blnRet As Boolean Dim sDWFFile As String Dim sPlotDriver As String sDWFFile = "c:\ari\Facility01.dwf" sPlotDriver = "c:\ari\DWF6 ePlot.pc3" blnRet = objPlot.PlotToFile(sDWFFile, sPlotDriver) End Sub thanks! Ari
I believe you could load the macro using LISP and put that LISP code in the AcadDoc.lsp file to load automatically with each drawing.
Create a project called ACAD.DVB. In it, create a STARTUP sub. Next make sure that you have the dvb in a folder in your support path along with an ACSII text file named ACAD.RX that has one line of code: ACVBA.ARX - for 2004+ ACADVBA - for 2000-2002 When AutoCAD starts, it'll look for acad.rx which will initialize vba within AutoCAD. Next, AutoCAD will load the acad.dvb and run whatever is in the startup sub. For events, just include their programming as a part of acad.dvb and they will activate whwn the file loads. As for GTVic's comment, you could resort to lisp but why mix programming languages when you don't need to. -- Mike ___________________________ Mike Tuersley ___________________________ the trick is to realize that there is no spoon...
Nope, it's still the same. Thanks for the correction, Ed! One of those, it's late and my mind is asleep posts. -- Mike ___________________________ Mike Tuersley ___________________________ the trick is to realize that there is no spoon...