VLAX.cls

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi,
I have an old vba macro that uses VLAX.cls to execute a lisp routine & pass the pagesetup name for the current sheet to vba. This routine has worked fine for many releases but I've just upgraded to 2015 & VLAX seems to be crashing Autocad. Anyone using VLAX.cls in 2015? I'm pretty sure you still can't access the curent page setup name thru VBA. Is there an updated version of VLAX? Can anyone suggest an alternative method of achieving the same thing? Thanks in advance.
Public Function GetCurrentPlotConfig(LayoutName As String)
'Returns the name of the current PlotConfig for the specified layout
'Must do this though lisp because vba does not expose this property.
'
Dim VL As VLAX
Dim strPC As String
Set VL = New VLAX
'make sure lisp function (CurrentPlotConfig) is loaded
VL.EvalLispExpression ("(if (null CurrentPlotConfig)(load ""CurrentPlotConfig.lsp""))")
strPC = "(CurrentPlotConfig """ & LayoutName & """)"
strPC = VL.EvalLispExpression(strPC)
Set VL = Nothing
GetCurrentPlotConfig = strPC
End Function
LISP ROUTINE
(defun CurrentPlotConfig (strLayout / layts layt pconfig )
;;; this function is used with vba.
;;; vba does not expose Page Setup Name. It is stored
;;; as the (1 . "name") of (100 . "AcDbPlotsettings") subgroup
;;; of the "ACAD_LAYOUT" named object dictionary.
(vl-load-com)
(setq layts (dictsearch (namedobjdict) "acad_layout"))
(setq layt (dictsearch (cdar layts) strLayout))
(setq pconfig (cdr (assoc 1 layt)))
)