ILowLevelSupport.RunMacro Return Value

ILowLevelSupport.RunMacro Return Value

ls-4453
Enthusiast Enthusiast
259 Views
4 Replies
Message 1 of 5

ILowLevelSupport.RunMacro Return Value

ls-4453
Enthusiast
Enthusiast

According to the documentation, when called on a VBA function, ILowLevelSupport.RunMacro should return the function's return value. However, when I try to use it, it only ever returns Empty. Has anyone been able to make this work?

0 Likes
260 Views
4 Replies
Replies (4)
Message 2 of 5

WCrihfield
Mentor
Mentor

Hi @ls-4453.  I am not even sure you can access the 'ILowLevelSupport' object within the VBA environment.  Most folks get the ApplicationAddIn object representing the iLogic add-in to a variable, then get its 'Automation' object to a variable (As Object), then use that the same way you would normally use iLogicVb.Automation in an iLogic rule, to run iLogic rules.  However, running a macro is a different thing, so that will not work.  There is a path to most of the VBA stuff from within an iLogic rule, but I do not think you would need to use that from the VBA environment.  If the other macro is Public, you should just be able to run it like calling a Sub to run.  Just use 'Call' followed by the name of the other Macro.  If the other Macro is not the main Sub of another Module, then you may have to include the Module.Sub name to access it.

By the way...a true Macro is a Sub routine, and does not have any input parameters, not a Function, so it would not really return anything.  That RunMacro method is defined within the iLogic add-in, and may simply not be available to access from the VBA environment.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 3 of 5

ls-4453
Enthusiast
Enthusiast

Thanks for your reply. I’m not accessing it from VBA, I’m using it from iLogic to run a VBA function and get the return value. According to the documentation, it provides the return value. Unfortunately, I can’t get it to work.

0 Likes
Message 4 of 5

WCrihfield
Mentor
Mentor

Ok.  I took another look at the documentation, and it does mention that the 'macro' you call to run with this method could be a function, so I must have been thinking about it from the 'Customization' point of view, where you can make buttons in your ribbon for macros.  I believe those macro's are limited to only being a Sub, and can not have any input parameters/arguments.  I honestly have not tried using iLogic's 'iLogicVb.RunMacro' method on a VBA function before, so this is certainly an interesting topic/issue.  What kind of object are you expecting to have returned from the function?

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 5 of 5

ls-4453
Enthusiast
Enthusiast

I tested it with a string, but if it works I want to use it with any arbitrary object.

 

My intent is that once it's working in iLogic, I'll call an iLogic rule from VBA which calls RunMacro and returns the return value (using RunExternalRuleWithArguments and the "Return" argument) and use it as a replacement for the Application.Run method that Office VBA environments have.

0 Likes