What is best VBA equivalent / alternative to iLogic's InputListBox statement?

What is best VBA equivalent / alternative to iLogic's InputListBox statement?

WCrihfield
Mentor Mentor
978 Views
5 Replies
Message 1 of 6

What is best VBA equivalent / alternative to iLogic's InputListBox statement?

WCrihfield
Mentor
Mentor

In iLogic, the InputListBox statement is incredibly useful, fairly easy to use, and I fully understand how to use it.

However, when I'm converting an iLogic rule that uses the InputListBox statement over to a VBA macro, I'm having a difficult time finding the best way to replace that portion of the code in VBA.

I'm trying to avoid having to create a UserForm, if possible.

All suggestions welcome.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
979 Views
5 Replies
Replies (5)
Message 2 of 6

chandra.shekar.g
Autodesk Support
Autodesk Support

@WCrihfield,

 

Hoping that suggestion in the below link may be helpful.

 

https://www.tutorialspoint.com/vba/vba_input_box.htm

 

Thanks and regards,


CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network



0 Likes
Message 3 of 6

WCrihfield
Mentor
Mentor

Thanks for taking the time to respond.  That one's not going to help.  I've already been using that one.  If there is no equivalent in VBA to iLogics InputListBox, that's a shame.  I thought that VBA was supposed to be more powerfull and have more options than iLogic, but I guess not in this situation.

So, as far as you know, creating a UserForm is the only way to interact with the user, and allow the user to choose a single option from a list of options?

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 4 of 6

JBerns
Advisor
Advisor

@WCrihfield,

 

It's my understanding that the VBA in Inventor is based on Visual Basic 6, a very early programming language.

 

I think iLogic utilizes the newer and more powerful version of VB.NET.

 

Anyone feel free to correct me if I am mistaken.

 

 

Regards,

Jerry

-----------------------------------------------------------------------------------------
CAD Administrator
Using AutoCAD & Inventor 2025
Autodesk Certified Instructor
Autodesk Inventor 2020 Certified Professional
Autodesk AutoCAD 2017 Certified Professional
Message 5 of 6

WCrihfield
Mentor
Mentor

You're probably right, @JBerns .  If I want to use this functionality in a Macro button, it would probably be easier to just run an external iLogic rule, at that point in the macro code, that calls the InputListBox Function, then return its answer to the macro.

I am much more comfortable and knowledgeable in iLogic right now than I am with VBA, and haven't really 'passed' arguments or values back and forth between iLogic and VBA before.  Could you perhaps recommend a few links or provide some code snippets that demonstrate this method(s)?  I would really appreciate it.

 

On the programming language preference note...as time permits, I am attempting to learn true VB.Net, so I can be more versatile in the Inventor Customization programming side of our designs.  I know it is directly compatible with the iLogic environment, so I think it would be most helpful.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 6 of 6

JBerns
Advisor
Advisor

@WCrihfield,

 

As you have discovered, VBA has nothing like iLogic's InputListBox. It is likely you would need to develop a UserForm with a ListBox to keep the code exclusively in VBA.

 

Have you seen these threads on running external iLogic rules from VBA? Perhaps they can offer some insight.

https://forums.autodesk.com/t5/inventor-customization/launch-external-ilogic-rule-with-vba/td-p/3170... 

https://forums.autodesk.com/t5/inventor-customization/ilogic-pass-an-argument-back-to-calling-rule/t...  

 

Is the end goal to have a macro that can be called from the ribbon? I'm sure you have probably explored the Inventor Add-in option. Brian Ekins has a great AU class.

https://www.autodesk.com/autodesk-university/class/Creating-Add-Ins-Inventor-2018 

 

Hope this helpful.

 

 

Regards,

Jerry

-----------------------------------------------------------------------------------------
CAD Administrator
Using AutoCAD & Inventor 2025
Autodesk Certified Instructor
Autodesk Inventor 2020 Certified Professional
Autodesk AutoCAD 2017 Certified Professional