What's wrong with this code ?

trathbun

Usenet Archive
Joined
Jul 14, 2003
Messages
12
Reaction score
0
Does anyone know what's wrong with this code ?

(defun c:zoom_e_save (/ $acad docs dnum this)
  (vl-load-com)
  (setq $acad (vlax-get-acad-object)
docs (vla-get-documents $acad)
this (vla-get-activedocument $acad)
dnum (vla-get-count docs)
  )
  (vlax-for each docs
    (vla-put-activedocument each)     (vla-zoomextents $acad)     (vla-save each)   )   (vla-put-activedocument this)   (vlax-release-object docs)   (vlax-release-object this)   (vlax-release-object $acad)   (princ (strcat "\nProcessed " (itoa dnum) " drawings."))   (princ)
)

Thanks,
 
Yeah. Visual LISP vacuums in MDI operations.

Place this VBA code in a standard module, and give it a try.

Public Sub Test
Dim App As AcadApplication
Set App = ThisDrawing.Application
Dim Doc As AcadDocument
For Each Doc In App.Documents
Doc.Activate
App.ZoomExtents
Doc.Save
Next Doc
MsgBox "Processed " & CStr(App.Documents.Count) & " drawings.", vbInformation, "Finished" Set App = Nothing End Sub

--
R. Robert Bell, MCSE
www.AcadX.com

| Does anyone know what's wrong with this code ?
| (defun c:zoom_e_save (/ $acad docs dnum this)
| (vl-load-com)
| (setq $acad (vlax-get-acad-object)
| docs (vla-get-documents $acad)
| this (vla-get-activedocument $acad)
| dnum (vla-get-count docs)
| )
| (vlax-for each docs
| (vla-put-activedocument each)
| (vla-zoomextents $acad)
| (vla-save each)
| )
| (vla-put-activedocument this)
| (vlax-release-object docs)
| (vlax-release-object this)
| (vlax-release-object $acad)
| (princ (strcat "\nProcessed " (itoa dnum) " drawings.")) | (princ) | ) | | Thanks, |
 

Latest threads

Back
Top