I have got 2 questions regarding global inventor forms.

I have got 2 questions regarding global inventor forms.

to_schroeder
Contributor Contributor
344 Views
4 Replies
Message 1 of 5

I have got 2 questions regarding global inventor forms.

to_schroeder
Contributor
Contributor

1. Is it possible to call a form from a vba macro?

 

2. i have made a form with all the important iproperties. My goal was that i have this form open and i quickly edit the iproperties from the parts by switching through the documents.

sadly the iproperties in the form wont update to match the iproperties from the active document.

 

How can i achieve that it automatically updates without reopening the form?

 

thanks in advance 🙂

0 Likes
Accepted solutions (1)
345 Views
4 Replies
Replies (4)
Message 2 of 5

WCrihfield
Mentor
Mentor

Hi @to_schroeder.  We can run an iLogic rule with a VBA macro, but I have never heard of anyone wanting to show an iLogic form from a VBA macro.  VBA has its own 'UserForms', which are more advanced than the iLogic forms, so when folks are using VBA, they usually just also use a VBA userform, instead of an iLogic form.  VBA and iLogic are two separate entities, and the iLogic forms are defined within the iLogic add in.  The VBA userforms can be more complicated to initially create, but offer a lot more options and flexibility in both design and function.  And no, usually you can not get an iLogic form to stay open and update itself when you switch between multiple documents.  We simply do not have that much control over those iLogic Forms from code.  We do have more control over VBA userforms by code though.  In fact the VBA userforms have their own code module in the VBA project tree, under the Forms folder.

Edit:  If you wanted to, you could have the VBA macro run an iLogic rule.  Then that iLogic rule that it runs could simply contain the needed code to show the iLogic Form if you wanted.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 3 of 5

to_schroeder
Contributor
Contributor
can a vba form also show and edit iproperties ?
0 Likes
Message 4 of 5

Curtis_Waguespack
Consultant
Consultant

Hi @to_schroeder ,

 

What version of Inventor are you using?  We might be able to do this with Inventor 2024 (I'd have to check to see for sure), as 2024 introduced some new functionality. But if using Inventor 2023 or earlier, I agree with @WCrihfield's assessment that an iLogic form will not work.

 

I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com

EESignature

0 Likes
Message 5 of 5

WCrihfield
Mentor
Mentor
Accepted solution

Yes.  And another of the many great things about using a VBA Form, is that if you want to use a list of pre-defined options to choose from, you do not need to have a multi-value UserParameter for the source of those options.  You can simply use a list that you have prepared right in the form's own UserForm code.  You can also make the UserForm a lot more 'interactive' than a normal iLogic Form, by including event handlers right into the UserForm's code.  For instance, when using a regular 'internal' iLogic form (saved within the document), it will instantly effect the model as you make changes in the form, but when using a 'global' iLogic form, that behavior is not present, and you must click [Apply] button to 'send' the changed values to the model, before the model will respond.  In a VBA UserForm, you can build in your own event handler codes to react to when values change in the UserForm's various specific controls, and when that event is triggered it can do what you want as a reaction to that event...meaning you can go ahead and 'push' those changed values to the model, as the changes take place.  But including things like event handlers can be a bit advanced or complicated, if you are not familiar with them.

 

Edit:  Below are a few links about VBA UserForms, and how to create them, just for reference.

https://learn.microsoft.com/en-us/office/vba/Language/Reference/User-Interface-Help/userform-object 

https://learn.microsoft.com/en-us/office/vba/excel/Concepts/Controls-DialogBoxes-Forms/create-a-user... 

https://www.automateexcel.com/vba/userforms/ 

https://excelmacromastery.com/vba-userform/ 

https://www.excel-easy.com/vba/userform.html 

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes