Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Import VBA module through API

3 REPLIES 3
SOLVED
Reply
Message 1 of 4
TA.Fehr
784 Views, 3 Replies

Import VBA module through API

Is there a way to import a vb module into the VBA editor through the API? 

I can add a new module with the command

InventorVBAComponents.Add()

But this adds an empty module. Is there a way I can populate this module from a text file? Or better yet, simply importing a .bas file into the VBA editor?

 

3 REPLIES 3
Message 2 of 4
GeorgK
in reply to: TA.Fehr

Maybe you can use or adapt this:

 

https://www.rondebruin.nl/win/s9/win002.htm

Message 3 of 4
TA.Fehr
in reply to: GeorgK

Good find, I'll see what I can make of it, but it does look promising.

Message 4 of 4
TA.Fehr
in reply to: GeorgK

Although the code wasn't transferable between excel and Inventor, it put me on the right path. I was able to find the import command through the "VBProject" container (although it was tough because Intellisence didn't acknowledge it existed, but it still works)

 

For the record this is the snippet that I am currently using

Dim oP As InventorVBAProject
For Each oP In _invApp.VBAProjects
    If oP.Name = "ApplicationProject" Then                
op.VBProject.vbcomponents.import("VBACode Location") exit for end If Next

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report