Problem running VBA macro from button - vl-vbarun

Problem running VBA macro from button - vl-vbarun

Anonymous
Not applicable
2,476 Views
9 Replies
Message 1 of 10

Problem running VBA macro from button - vl-vbarun

Anonymous
Not applicable

Hi

 

Can someone please shed some light as to why one operator out of four of us, can't run vba macros from a lisp command?  I've checked the permissions and trusted folder locations etc, and can't find anything obviously wrong.

 

I have a number of buttons on a tool palette that has a macro line similar to "(vl-vbarun "X:/Programs/MTMERGE.dvb!MTMERGE") in it.  Whenever this particular operator clicks the button (or types in long hand at the prompt, the following happens (and nothing else).

 

macro.JPG 

 

 

 

 

 

 

 

 

It just adds that random 'T' at the end and nothing else happens, least of all any attempt to fire the macro.  I've also tried a less crude method using (vl-vbaload) first then (vl-vbarun). The vbaload part seems to work, but the vbarun part just returns 'T'.

 

I'm not clued up with lisp so very stumped as to what's going on here. 

 

Any help would be most appreciated.

 

Many thanks

 

Graham

0 Likes
Accepted solutions (1)
2,477 Views
9 Replies
Replies (9)
Message 2 of 10

Alfred.NESWADBA
Consultant
Consultant

Hi,

 

what happens when you don't use LISP to call that?

Same should work using command _-VBARUN, at least you should get messages if errors happened.

 

- alfred -

 

------------------------------------------------------------------------------------
Alfred NESWADBA
ISH-Solutions GmbH / Ingenieur Studio HOLLAUS
www.ish-solutions.at ... blog.ish-solutions.at ... LinkedIn ... CDay 2025
------------------------------------------------------------------------------------

(not an Autodesk consultant)
0 Likes
Message 3 of 10

Anonymous
Not applicable

Hi

 

Thanks for the suggestion.

 

If not using lisp it all works ok.  I substituted the lisp code with normal command line text to load the dvb then run the macro and it works fine. Problem now is though, that the second time the script is executed it flags up a warning about the dvb file already being loaded.

 

This is the command string behind the button

 

_-vbaload "X:/Central Library/Reference Files/Programs/MTMERGE.dvb" _-vbarun "MTMERGE" 

 

Cheers

0 Likes
Message 4 of 10

Anonymous
Not applicable
Accepted solution

Temporary work-around is to use lisp code for the load part and command line entry for the run part, all within the same string.

 

It's a very strange problem. Can't figure out why just one PC doesn't like lisp to call vbarun......

0 Likes
Message 5 of 10

Anonymous
Not applicable

I have the same problem (Student Version 2017)

Any solution?

0 Likes
Message 6 of 10

Anonymous
Not applicable

My temporary solution was as my post above.  However there are other issues with the PC in question where it won't run all code correctly, so that PC is going to have to be nuked and reinstalled.

0 Likes
Message 7 of 10

Ed__Jobe
Mentor
Mentor

I prefer to avoid using vbarun all together. I define lisp command wrappers for my macros. This not only makes menu macros simpler, but makes it so that you can hit the Enter key to repeat the command. Also, auotcomplete recognizes the command, so you can just type it.

Ed


Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
How to post your code.

EESignature

Message 8 of 10

Anonymous
Not applicable

I did that years back for another company, but couldn't remember the code (not being a lisp bloke).  Can you share the necessary code please?  Also, do you know if it's possible to have that code in a file on a network drive so all PC's can read and load it when starting AutoCAD?

 

Cheers 🙂

0 Likes
Message 9 of 10

Ed__Jobe
Mentor
Mentor

The code is posted at the link I gave you.

I put the code in a cui mnl file so it loads with the menu. You can have a cui on the network.

Ed


Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
How to post your code.

EESignature

Message 10 of 10

Ed__Jobe
Mentor
Mentor

The one problem with putting your vba and lisp on the network is that you can't make changes to it while its in use. I have everything local to each pc and when I update the menu/code, I copy it local. There are several ways to do this. I have a custom dll that loads on start up and checks for updates.

Ed


Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
How to post your code.

EESignature

0 Likes