<?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: using Command Manager in VBA in Inventor Programming Forum</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-forum/using-command-manager-in-vba/m-p/10834269#M42167</link>
    <description>&lt;P&gt;Thanks to&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/339467"&gt;@adam.nagy&lt;/a&gt;&amp;nbsp;, the user form must be modeless and that solves the issue.&lt;/P&gt;</description>
    <pubDate>Mon, 20 Dec 2021 18:58:42 GMT</pubDate>
    <dc:creator>3DAli</dc:creator>
    <dc:date>2021-12-20T18:58:42Z</dc:date>
    <item>
      <title>using Command Manager in VBA</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/using-command-manager-in-vba/m-p/10830016#M42166</link>
      <description>&lt;P&gt;Hi There,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I came across this situation and it has puzzled me, if you can share your thoughts and experience, would be greatly appreciated&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;when I use command manager like below (it could be any command, this is an example)&lt;/P&gt;&lt;LI-CODE lang="general"&gt;ThisApplication.CommandManager.ControlDefinitions.Item("GeomToDXFCommand")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;if its sitting in a module in VBA and you run it as macro, it works fine without any issue, however , if you insert a userform and place the code in a command button on the form, it wont work, and it wont give you any warning or error as if it's run properly but it does not in fact fire up the command. see below&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;Private Sub CommandButton1_Click()
Dim pd As PartDocument
Set pd = ThisApplication.ActiveDocument

Dim oDef As PartComponentDefinition
Set oDef = pd.ComponentDefinition

pd.SubType = "{9C464203-9BAE-11D3-8BAD-0060B0CE6BB4}"

Dim F As Face
Set F = pd.ComponentDefinition.SurfaceBodies(1).Faces(2)

Call pd.SelectSet.Select(F)

Dim cd As ButtonDefinition
Set cd = ThisApplication.CommandManager.ControlDefinitions.Item("GeomToDXFCommand")

' To void user interaction
'Call ThisApplication.CommandManager.PostPrivateEvent(PrivateEventTypeEnum.kFileNameEvent, "C:\DXF\Test.dxf")

Call cd.Execute

End Sub&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;same code works perfectly fine when its place in a module (see below)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="3DAli_0-1639770810733.png" style="width: 400px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1002844i85B431BFEE2E9CC3/image-size/medium?v=v2&amp;amp;px=400" role="button" title="3DAli_0-1639770810733.png" alt="3DAli_0-1639770810733.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;any idea as to whether or not this is a normal behavior or if there is any missing steps.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Ali&lt;/P&gt;</description>
      <pubDate>Fri, 17 Dec 2021 19:54:12 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/using-command-manager-in-vba/m-p/10830016#M42166</guid>
      <dc:creator>3DAli</dc:creator>
      <dc:date>2021-12-17T19:54:12Z</dc:date>
    </item>
    <item>
      <title>Re: using Command Manager in VBA</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/using-command-manager-in-vba/m-p/10834269#M42167</link>
      <description>&lt;P&gt;Thanks to&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/339467"&gt;@adam.nagy&lt;/a&gt;&amp;nbsp;, the user form must be modeless and that solves the issue.&lt;/P&gt;</description>
      <pubDate>Mon, 20 Dec 2021 18:58:42 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/using-command-manager-in-vba/m-p/10834269#M42167</guid>
      <dc:creator>3DAli</dc:creator>
      <dc:date>2021-12-20T18:58:42Z</dc:date>
    </item>
  </channel>
</rss>

