call vba module from a global ilogic form in Inventor 2018

call vba module from a global ilogic form in Inventor 2018

cmines
Enthusiast Enthusiast
1,158 Views
4 Replies
Message 1 of 5

call vba module from a global ilogic form in Inventor 2018

cmines
Enthusiast
Enthusiast

Is it possible to call a vba module from a global ilogic form?  If so, could someone please give an example?

Thanks!

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

JaneFan
Autodesk
Autodesk

Hey @cmines

 

It is possible. Here are steps: 

1. Launch inventor, create a module named as "TestM" in ApplicationProject level, with a subroutine "test1"

Sub test1()
MsgBox "test"
End Sub

2. Create a rule, global or not as needed, with following code: 

Version:1.0 StartHTML:00000145 EndHTML:00000615 StartFragment:00000294 EndFragment:00000583 StartSelection:00000294 EndSelection:00000294SyntaxEditor Code Snippet

InventorVb.RunMacro("Applicationproject", "TestM", "Test1")

 

3. Create a global form, drag the rule into the form. 

 

 




Jane Fan
Inventor/Fusion QA Engineer
0 Likes
Message 3 of 5

cmines
Enthusiast
Enthusiast

Hi @JaneFan,

I tried this code with nothing else in the rule and I got "syntax error" for every line.  I apologize if I just missed a basic step, but I am not a programmer.  Tried with code exactly as you posted as well as a couple other unsuccessful versions.   What am I missing?

Thanks again for your help!

 

 

0 Likes
Message 4 of 5

cmines
Enthusiast
Enthusiast

Hi @JaneFan,

One other thing.... when I keyed the code exactly as you have it, I did get a different error.  I got "Unit name "StartHTML" is not valid in Inventor.  Also got that error message for EndHTML, StartFragment, and EndFragment.

 

Thanks again!

0 Likes
Message 5 of 5

JaneFan
Autodesk
Autodesk
Accepted solution

Hey @cmines,

 

In iLogic rule, please only add this line:

InventorVb.RunMacro("Applicationproject", "TestM", "Test1")

 The description "Version:1.0 StartHTML:00000145......" is invalid lines.




Jane Fan
Inventor/Fusion QA Engineer