How do you call a VBA function from the ribbon?

How do you call a VBA function from the ribbon?

dbrblg
Collaborator Collaborator
1,992 Views
1 Reply
Message 1 of 2

How do you call a VBA function from the ribbon?

dbrblg
Collaborator
Collaborator

I have a function called 'UpdateAttributePosistion' which resides in a module called 'Positioning' inside a DVB file in the support path.

 

What is the correct macro I need in order to run this from a ribbon button?

 

At the moment I have:

^C^C_.-vbarun;"Z:\Macros\<long support path>\AC.dvb!Positioning.UpdateAttributePosistion"

which firstly doesn't work and secondly I'd like to be able not to have to specify a path in case this changes in the future.  I would like this to find the project via the support path.

 

I do have macros along these lines:

^C^C^P(if (setq x (findfile "ACAD.lsp"))(progn(load x)(c:PrintA3Model)) " ")

which finds the function via the support path but I'm unsure of how to modify this in order to find a DVB project and call the 'UpdateAttributePosistion' function from within the 'Positioning'  module.

 

Thanks

 

0 Likes
Accepted solutions (1)
1,993 Views
1 Reply
Reply (1)
Message 2 of 2

Ed__Jobe
Mentor
Mentor
Accepted solution

Check this thread for syntax on getting the vbarun function to work. However, my preferred method is to define lisp C: commands for the vba. That does 2 things, first it shortens the cui macro to just the command name. Most importantly, it enables you to repeat the command using the {enter} key. If you hit enter when using vbarun, it just prompts you for the macro name. Since you are creating a cui for other users, the best way to accomplish this task is to create a mnl file for use with your cui. Give it the same name as your cui and it will load automatically when the cui loads. The mnl can also take care of loading the dvb. For a deeper discussion on this technique see this thread.

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