<?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: How to get PartDocument object from mouse selection by vba? in Inventor Programming Forum</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-forum/how-to-get-partdocument-object-from-mouse-selection-by-vba/m-p/9040730#M71310</link>
    <description>&lt;P&gt;Hi, here is an example of how to access through VBA. When you select a component in the graphic window or in the navigator tree you will see the name of the file.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Sub Select_Component()

    Dim oCC As ComponentOccurrence
    Set oCC = ThisApplication.CommandManager.Pick(16643, "Select Component")
    'kAssemblyLeafOccurrenceFilter 16643 Assembly leaf occurrence filter.
    'kAssemblyOccurrenceFilter 16640 Assembly occurrence filter.
    
    Dim oDoc As Document
    Set oDoc = oCC.Definition.Document
    MsgBox (oDoc.DisplayName)

End Sub&lt;/PRE&gt;&lt;P&gt;Here the same action with ilogic.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oCC&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;ComponentOccurrence&lt;/SPAN&gt; = &lt;SPAN&gt;ThisApplication&lt;/SPAN&gt;.&lt;SPAN&gt;CommandManager&lt;/SPAN&gt;.&lt;SPAN&gt;Pick&lt;/SPAN&gt;(16643, &lt;SPAN&gt;"Select Component"&lt;/SPAN&gt;)
&lt;SPAN&gt;'kAssemblyLeafOccurrenceFilter 16643 Assembly leaf occurrence filter. &lt;/SPAN&gt;
&lt;SPAN&gt;'kAssemblyOccurrenceFilter 16640 Assembly occurrence filter.&lt;/SPAN&gt;

&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oDoc&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;Document&lt;/SPAN&gt; = &lt;SPAN&gt;oCC&lt;/SPAN&gt;.&lt;SPAN&gt;Definition&lt;/SPAN&gt;.&lt;SPAN&gt;Document&lt;/SPAN&gt;
&lt;SPAN&gt;MessageBox&lt;/SPAN&gt;.&lt;SPAN&gt;Show&lt;/SPAN&gt;(&lt;SPAN&gt;oDoc&lt;/SPAN&gt;.&lt;SPAN&gt;DisplayName&lt;/SPAN&gt;)&lt;/PRE&gt;&lt;P&gt;I hope this helps with your problem. Regards&lt;/P&gt;</description>
    <pubDate>Mon, 23 Sep 2019 14:28:43 GMT</pubDate>
    <dc:creator>Sergio.D.Suárez</dc:creator>
    <dc:date>2019-09-23T14:28:43Z</dc:date>
    <item>
      <title>How to get PartDocument object from mouse selection by vba?</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/how-to-get-partdocument-object-from-mouse-selection-by-vba/m-p/9040638#M71309</link>
      <description>&lt;P&gt;I have an active assembly, where I would like to select a part or subassembly by clicking on model (not browser). How can I get PartDocument or AssemblyDocument object from mouse selection?&lt;/P&gt;</description>
      <pubDate>Mon, 23 Sep 2019 13:53:10 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/how-to-get-partdocument-object-from-mouse-selection-by-vba/m-p/9040638#M71309</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-09-23T13:53:10Z</dc:date>
    </item>
    <item>
      <title>Re: How to get PartDocument object from mouse selection by vba?</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/how-to-get-partdocument-object-from-mouse-selection-by-vba/m-p/9040730#M71310</link>
      <description>&lt;P&gt;Hi, here is an example of how to access through VBA. When you select a component in the graphic window or in the navigator tree you will see the name of the file.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Sub Select_Component()

    Dim oCC As ComponentOccurrence
    Set oCC = ThisApplication.CommandManager.Pick(16643, "Select Component")
    'kAssemblyLeafOccurrenceFilter 16643 Assembly leaf occurrence filter.
    'kAssemblyOccurrenceFilter 16640 Assembly occurrence filter.
    
    Dim oDoc As Document
    Set oDoc = oCC.Definition.Document
    MsgBox (oDoc.DisplayName)

End Sub&lt;/PRE&gt;&lt;P&gt;Here the same action with ilogic.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oCC&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;ComponentOccurrence&lt;/SPAN&gt; = &lt;SPAN&gt;ThisApplication&lt;/SPAN&gt;.&lt;SPAN&gt;CommandManager&lt;/SPAN&gt;.&lt;SPAN&gt;Pick&lt;/SPAN&gt;(16643, &lt;SPAN&gt;"Select Component"&lt;/SPAN&gt;)
&lt;SPAN&gt;'kAssemblyLeafOccurrenceFilter 16643 Assembly leaf occurrence filter. &lt;/SPAN&gt;
&lt;SPAN&gt;'kAssemblyOccurrenceFilter 16640 Assembly occurrence filter.&lt;/SPAN&gt;

&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oDoc&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;Document&lt;/SPAN&gt; = &lt;SPAN&gt;oCC&lt;/SPAN&gt;.&lt;SPAN&gt;Definition&lt;/SPAN&gt;.&lt;SPAN&gt;Document&lt;/SPAN&gt;
&lt;SPAN&gt;MessageBox&lt;/SPAN&gt;.&lt;SPAN&gt;Show&lt;/SPAN&gt;(&lt;SPAN&gt;oDoc&lt;/SPAN&gt;.&lt;SPAN&gt;DisplayName&lt;/SPAN&gt;)&lt;/PRE&gt;&lt;P&gt;I hope this helps with your problem. Regards&lt;/P&gt;</description>
      <pubDate>Mon, 23 Sep 2019 14:28:43 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/how-to-get-partdocument-object-from-mouse-selection-by-vba/m-p/9040730#M71310</guid>
      <dc:creator>Sergio.D.Suárez</dc:creator>
      <dc:date>2019-09-23T14:28:43Z</dc:date>
    </item>
  </channel>
</rss>

