Call VB Macro from iLogic rule in same partdocument
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
This is breaking my brains... 🤔
Is there a way to call a VB-macro from an iLogic rule that resides in the same part document? This is the situation.
- I have a sheetmetal part that is highly customizable.
- This part document has its own (local) iLogic form and rules to configure the part
- This part document also has its own (local) VB-macro as well (so there's no central VB-project file)
- This VB-macro has some (complex?) code to control some features to be suppressed or enabled
- The VB-macro is placed in the "Modules" folder (for example "Module1")
- The iLogic form and rule, and the VB-macro independently work correctly, but the VB-macro must be started manually by opening the VBA editor and starting the macro.
My goal is to have an iLogic rule start the VB-macro, and both of them reside in the same part document.
I tried the command:
InventorVb.RunMacro("DocumentProject", "Module1", "test")
(in this case the macro "test" contains only a messagebox for test purposes)
But running it results in the message:
Error in rule: OpenDialog, in document: CustomSheetPart.ipt RunMacro: No VBA macro named "test" was found in the component or module named "Module1", in the VBA project named "DocumentProject".
I tried changing the project argument to the filename of the part, or leaving it blank, but that doesn't work either.
I'd like to know what I'm doing wrong. Is it anyway possible? Can anyone push me in the right direction?
Thanks in advance.
Product Design Suite 2024
Inventor 2024 (v 28.20.27200.0000), Vault Basic 2024
Fusion 360
HP Workstation Z4
Intel Xeon 3.4GHz
32GB RAM
Windows 10 Professional (64bit)