Using a loaded macro in two or more open drawings

Using a loaded macro in two or more open drawings

Anonymous
Not applicable
255 Views
2 Replies
Message 1 of 3

Using a loaded macro in two or more open drawings

Anonymous
Not applicable
I have a drawing template that has a VBA macro attached to it that is loaded when a new drawing is created from the template. If I type vbarun then I see only one macro available: "Drawing1.Module2.ECMacro". I have created a tiny LISP routine to automatically run this:

(defun c:ec()
(command "-vbarun" "ECMacro")
)

This works fine and will start the macro which basically is just a nice interface which allows the user to load in different sets of layers based on different disciplines.

The problem is when I have one drawing with this macro attached to it and then open a second drawing that has been created by the template as well. If I try and run the LISP routine on the second drawing, the layers load into the first drawing.

I see that when I run vbarun on the second drawing I am presented with two macro options, "ECMacro" on Drawing1 and the same on Drawing2 with the first drawing being the default selection which is most likely why the layers get created in the wrong drawing.

Is there an easy way to get around this? I appreciate all of your help!

Nick
0 Likes
256 Views
2 Replies
Replies (2)
Message 2 of 3

Anonymous
Not applicable
Is the VBA project *embedded* in the template? I would not advise that. Just
load the project from Acad.lsp, and execute it from AcadDoc.lsp.

--
R. Robert Bell


wrote in message news:5411963@discussion.autodesk.com...
I have a drawing template that has a VBA macro attached to it that is loaded
when a new drawing is created from the template. If I type vbarun then I see
only one macro available: "Drawing1.Module2.ECMacro". I have created a tiny
LISP routine to automatically run this:

(defun c:ec()
(command "-vbarun" "ECMacro")
)

This works fine and will start the macro which basically is just a nice
interface which allows the user to load in different sets of layers based on
different disciplines.

The problem is when I have one drawing with this macro attached to it and
then open a second drawing that has been created by the template as well. If
I try and run the LISP routine on the second drawing, the layers load into
the first drawing.

I see that when I run vbarun on the second drawing I am presented with two
macro options, "ECMacro" on Drawing1 and the same on Drawing2 with the first
drawing being the default selection which is most likely why the layers get
created in the wrong drawing.

Is there an easy way to get around this? I appreciate all of your help!

Nick
0 Likes
Message 3 of 3

Anonymous
Not applicable
Okay, I'll try that. Thanks for your help.

Nick
0 Likes