<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Run Inventor Macro from Excel in Inventor Forum</title>
    <link>https://forums.autodesk.com/t5/inventor-forum/run-inventor-macro-from-excel/m-p/7378725#M263402</link>
    <description>&lt;P&gt;Thanks for your reply.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I just managed to do it myself via the following code. I guess your way is more elegant.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;    Dim invApp As inventor.Application
    Set invApp = GetObject(, "Inventor.Application")

    Dim invVBAProject As InventorVBAProject
    Set invVBAProject = invApp.VBAProjects.Item(2)

    Dim invModule As InventorVBAComponent
    Set invModule = invVBAProject.InventorVBAComponents.Item("Main")

    Dim invSub As InventorVBAMember
    Set invSub = invModule.InventorVBAMembers.Item("test")

    invSub.Execute&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If anyone ever wants to do the same thing as I did:&lt;/P&gt;&lt;P&gt;It doesn't work to open the Inventor Project and immediatley execute the macro, so it isn't possible to use just one macro. The Execution has to start when inventor is fully loaded not a second before, otherwise this Error appears "ActiveX Component Can't Create Object (429)".&lt;/P&gt;&lt;P&gt;&amp;nbsp;I simply use one button to start inventor and a second one to trigger the macro.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Maybe it helps someone&lt;/P&gt;&lt;P&gt;-Jake&lt;/P&gt;</description>
    <pubDate>Wed, 13 Sep 2017 20:24:40 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2017-09-13T20:24:40Z</dc:date>
    <item>
      <title>Run Inventor Macro from Excel</title>
      <link>https://forums.autodesk.com/t5/inventor-forum/run-inventor-macro-from-excel/m-p/7378513#M263400</link>
      <description>&lt;P&gt;Hello there,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm trying to launch an inventor Macro via an Excel Command Button.&lt;/P&gt;&lt;P&gt;I've managed to open the inveotor document in which all the macros are. Now all left to do is to run one macro.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried for hours and, sadly, I'm not able to get this to work.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is what I have:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Public Sub CommandButton1_Click()

    Dim InvFilename As String
    
    CommandButton1.Caption = "hello there."

    InvFilename = "my_path"

    InvFilename = "C:\Program Files\Autodesk\Inventor 2017\Bin\inventor.exe """ &amp;amp; InvFilename &amp;amp; """"

    Call Shell(InvFilename, 1)
    

    Dim inv As Object
    Set inv = CreateObject("Inventor.Application")
    inv.Run "Module1.test"                              '&amp;lt;-----------------------ERROR 438

End Sub&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is the Error Message I get: Object doesn't support this property or method. 438&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can someone please help me?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;-Jake&lt;/P&gt;</description>
      <pubDate>Wed, 13 Sep 2017 19:01:49 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-forum/run-inventor-macro-from-excel/m-p/7378513#M263400</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-09-13T19:01:49Z</dc:date>
    </item>
    <item>
      <title>Re: Run Inventor Macro from Excel</title>
      <link>https://forums.autodesk.com/t5/inventor-forum/run-inventor-macro-from-excel/m-p/7378605#M263401</link>
      <description>&lt;PRE&gt;invApp.VBAProjects(1).InventorVBAComponents("AppEventController").InventorVBAMembers("StartEvent").Execute&lt;/PRE&gt;</description>
      <pubDate>Wed, 13 Sep 2017 19:36:01 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-forum/run-inventor-macro-from-excel/m-p/7378605#M263401</guid>
      <dc:creator>MechMachineMan</dc:creator>
      <dc:date>2017-09-13T19:36:01Z</dc:date>
    </item>
    <item>
      <title>Re: Run Inventor Macro from Excel</title>
      <link>https://forums.autodesk.com/t5/inventor-forum/run-inventor-macro-from-excel/m-p/7378725#M263402</link>
      <description>&lt;P&gt;Thanks for your reply.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I just managed to do it myself via the following code. I guess your way is more elegant.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;    Dim invApp As inventor.Application
    Set invApp = GetObject(, "Inventor.Application")

    Dim invVBAProject As InventorVBAProject
    Set invVBAProject = invApp.VBAProjects.Item(2)

    Dim invModule As InventorVBAComponent
    Set invModule = invVBAProject.InventorVBAComponents.Item("Main")

    Dim invSub As InventorVBAMember
    Set invSub = invModule.InventorVBAMembers.Item("test")

    invSub.Execute&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If anyone ever wants to do the same thing as I did:&lt;/P&gt;&lt;P&gt;It doesn't work to open the Inventor Project and immediatley execute the macro, so it isn't possible to use just one macro. The Execution has to start when inventor is fully loaded not a second before, otherwise this Error appears "ActiveX Component Can't Create Object (429)".&lt;/P&gt;&lt;P&gt;&amp;nbsp;I simply use one button to start inventor and a second one to trigger the macro.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Maybe it helps someone&lt;/P&gt;&lt;P&gt;-Jake&lt;/P&gt;</description>
      <pubDate>Wed, 13 Sep 2017 20:24:40 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-forum/run-inventor-macro-from-excel/m-p/7378725#M263402</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-09-13T20:24:40Z</dc:date>
    </item>
    <item>
      <title>Re: Run Inventor Macro from Excel</title>
      <link>https://forums.autodesk.com/t5/inventor-forum/run-inventor-macro-from-excel/m-p/7378949#M263403</link>
      <description>You can do it all in one by having a wait loop to delay the code until the&lt;BR /&gt;invApp.Ready = True&lt;BR /&gt;</description>
      <pubDate>Wed, 13 Sep 2017 22:07:14 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-forum/run-inventor-macro-from-excel/m-p/7378949#M263403</guid>
      <dc:creator>MechMachineMan</dc:creator>
      <dc:date>2017-09-13T22:07:14Z</dc:date>
    </item>
  </channel>
</rss>

