<?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: Find Next Part Number using Vba in Inventor Programming Forum</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-forum/find-next-part-number-using-vba/m-p/7410802#M97819</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Maybe not that easy as you wrote in your first post.. &amp;nbsp;&lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It is still quite hard to fololow what you want..&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Do like this..&lt;/P&gt;
&lt;P&gt;Create a zip-file with an example structure.&lt;/P&gt;
&lt;P&gt;Then try to explain with text what you want to happen with your files in your zip..&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I think it will be a lot easier if we have an example to try with and have file with the right naming.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;/Rikard&lt;/P&gt;</description>
    <pubDate>Tue, 26 Sep 2017 19:00:40 GMT</pubDate>
    <dc:creator>rikard.nilsson</dc:creator>
    <dc:date>2017-09-26T19:00:40Z</dc:date>
    <item>
      <title>Find Next Part Number using Vba</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/find-next-part-number-using-vba/m-p/7397871#M97814</link>
      <description>&lt;P&gt;This one should be easy for all the vba gurus out there. What I'm looking to do is find the next available part number in&amp;nbsp;a certain job folder. the folder structure is as follows:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;T:\Jobs\Jobs JA-JZ\JF8\PARTS&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When the designers detail out parts, (primarily in AutoCAD, not quite using 3D but that's the direction we are headed..) they need to know the next available number in the Parts folder so they can fill in their title block. As we transition to 3D, we need the same functionality but for saving part files. I have a userform set up to receive the next number but I have no idea as how to gather all the current part numbers into a collection, sort them from lowest part number to highest&amp;nbsp;(ex: the first PN a designer uses above is JF8x101, where the "x" could be "A", "B", "C", etc for the sheet size its drawn on), &lt;STRONG&gt;then&lt;/STRONG&gt; exclude any parts that don't begin with the job number string "JF8" (We sometimes use reference parts from other jobs that shouldn't be included). That's the pseudocode. The implementation is beyond my skills at this point.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And one other point - there's times when part numbers are intentionally skipped. A designer may skip using part numbers JF8x150-153 to allow for a future weldment. The program would have to find the next number as JF8x150, not JF8x154. If that makes sense.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any programs or helps are always appreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here's what the userform looks like.(see attached)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Sep 2017 12:47:34 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/find-next-part-number-using-vba/m-p/7397871#M97814</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-09-21T12:47:34Z</dc:date>
    </item>
    <item>
      <title>Re: Find Next Part Number using Vba</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/find-next-part-number-using-vba/m-p/7402885#M97815</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I hope I understod you right,, But here is a code that find the gaps and also fins the next free number after all files has been checked..&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It's written in iLogic but I will not be any problem for you to convert the code to VBA..&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;/Rikard&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;Path&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;String&lt;/SPAN&gt; &lt;SPAN&gt;=&lt;/SPAN&gt; &lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN&gt;D:\support\JF8\&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;

&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;files&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;String&lt;/SPAN&gt;&lt;SPAN&gt;()&lt;/SPAN&gt; &lt;SPAN&gt;=&lt;/SPAN&gt; &lt;SPAN&gt;System&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;IO&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;Directory&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;GetFiles&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;Path&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN&gt;JF8*.dwg&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;

&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;listOfFileNumbers&lt;/SPAN&gt; &lt;SPAN&gt;as&lt;/SPAN&gt; &lt;SPAN&gt;New&lt;/SPAN&gt; &lt;SPAN&gt;List&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;Of&lt;/SPAN&gt; &lt;SPAN&gt;Integer&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;
&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;justFileName&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;String&lt;/SPAN&gt;
&lt;SPAN&gt;For&lt;/SPAN&gt; &lt;SPAN&gt;Each&lt;/SPAN&gt; &lt;SPAN&gt;item&lt;/SPAN&gt; &lt;SPAN&gt;in&lt;/SPAN&gt; &lt;SPAN&gt;files&lt;/SPAN&gt;
&lt;SPAN&gt;justFileName&lt;/SPAN&gt; &lt;SPAN&gt;=&lt;/SPAN&gt; &lt;SPAN&gt;System&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;IO&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;Path&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;GetFileNameWithoutExtension&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;item&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;
&lt;SPAN&gt;listOfFileNumbers&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;add&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;CInt&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;Right&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;justFileName&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;justFileName&lt;/SPAN&gt;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PAN&gt; &lt;SPAN&gt;listOfFileNumbers&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;i&lt;/SPAN&gt;&lt;SPAN&gt;+&lt;/SPAN&gt;&lt;SPAN&gt;1&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt; &lt;SPAN&gt;Then&lt;/SPAN&gt;
        &lt;SPAN&gt;For&lt;/SPAN&gt; &lt;SPAN&gt;ii&lt;/SPAN&gt;&lt;SPAN&gt;=&lt;/SPAN&gt; &lt;SPAN&gt;listOfFileNumbers&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;i&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;SPAN&gt;+&lt;/SPAN&gt;&lt;SPAN&gt;1&lt;/SPAN&gt; &lt;SPAN&gt;To&lt;/SPAN&gt; &lt;SPAN&gt;listOfFileNumbers&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;i&lt;/SPAN&gt;&lt;SPAN&gt;+&lt;/SPAN&gt;&lt;SPAN&gt;1&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;SPAN&gt;-&lt;/SPAN&gt;&lt;SPAN&gt;1&lt;/SPAN&gt;
            &lt;SPAN&gt;'&lt;/SPAN&gt;&lt;SPAN&gt; Add the gaps..&lt;/SPAN&gt;
            &lt;SPAN&gt;listOfFileNumbersThatNotIsUsed&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;add&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;ii&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;
        &lt;SPAN&gt;Next&lt;/SPAN&gt;
    &lt;SPAN&gt;End&lt;/SPAN&gt; &lt;SPAN&gt;If&lt;/SPAN&gt;
&lt;SPAN&gt;Next&lt;/SPAN&gt;
&lt;SPAN&gt;'&lt;/SPAN&gt;&lt;SPAN&gt; Add one last number&lt;/SPAN&gt;
&lt;SPAN&gt;listOfFileNumbersThatNotIsUsed&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;add&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;listOfFileNumbers&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;listOfFileNumbers&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;count&lt;/SPAN&gt;&lt;SPAN&gt;-&lt;/SPAN&gt;&lt;SPAN&gt;1&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;SPAN&gt;+&lt;/SPAN&gt;&lt;SPAN&gt;1&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;


&lt;SPAN&gt;For&lt;/SPAN&gt; &lt;SPAN&gt;Each&lt;/SPAN&gt; &lt;SPAN&gt;item&lt;/SPAN&gt; &lt;SPAN&gt;in&lt;/SPAN&gt; &lt;SPAN&gt;listOfFileNumbersThatNotIsUsed&lt;/SPAN&gt;
    &lt;SPAN&gt;MessageBox&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;Show&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;item&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN&gt;Title&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;
&lt;SPAN&gt;Next&lt;/SPAN&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 22 Sep 2017 21:11:39 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/find-next-part-number-using-vba/m-p/7402885#M97815</guid>
      <dc:creator>rikard.nilsson</dc:creator>
      <dc:date>2017-09-22T21:11:39Z</dc:date>
    </item>
    <item>
      <title>Re: Find Next Part Number using Vba</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/find-next-part-number-using-vba/m-p/7407624#M97816</link>
      <description>&lt;P&gt;Rikard,&lt;/P&gt;&lt;P&gt;I'm not sure how to convert from ilogic to straight VB code. Can you help with this? and the code as given produces an error (see attached).&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Pat&lt;/P&gt;</description>
      <pubDate>Mon, 25 Sep 2017 20:08:47 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/find-next-part-number-using-vba/m-p/7407624#M97816</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-09-25T20:08:47Z</dc:date>
    </item>
    <item>
      <title>Re: Find Next Part Number using Vba</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/find-next-part-number-using-vba/m-p/7407739#M97817</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;I haven't done a VBA code for at least 15 years so I'm not the right person for that. &lt;BR /&gt;If you google how to change code from vba to vb.net then you should be able to do it from vb.net to vba. &lt;BR /&gt;But I recommend to do addins instead of vba. &lt;BR /&gt;&lt;BR /&gt;Can you please send a picture of your files in the folder you check?&lt;BR /&gt;&lt;BR /&gt;In my folder I had placed file with different letters after JFB. And then with numbers&lt;BR /&gt;101, 102, 103, 107, 108, 109. &lt;BR /&gt;And that did not give any errors. &lt;BR /&gt;&lt;BR /&gt;/Rikard</description>
      <pubDate>Mon, 25 Sep 2017 20:50:28 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/find-next-part-number-using-vba/m-p/7407739#M97817</guid>
      <dc:creator>rikard.nilsson</dc:creator>
      <dc:date>2017-09-25T20:50:28Z</dc:date>
    </item>
    <item>
      <title>Re: Find Next Part Number using Vba</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/find-next-part-number-using-vba/m-p/7409217#M97818</link>
      <description>&lt;P&gt;see attached.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When the detailers make the manufactured part drawings, they divide them into subfolders under the main job folder. I have shown what the "Shafts" folder structure looks like but some of the other folders ("Frames" for example) have multiple levels of subfolders under them. Not sure if that affects the code or not.&lt;/P&gt;</description>
      <pubDate>Tue, 26 Sep 2017 11:30:28 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/find-next-part-number-using-vba/m-p/7409217#M97818</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-09-26T11:30:28Z</dc:date>
    </item>
    <item>
      <title>Re: Find Next Part Number using Vba</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/find-next-part-number-using-vba/m-p/7410802#M97819</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Maybe not that easy as you wrote in your first post.. &amp;nbsp;&lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It is still quite hard to fololow what you want..&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Do like this..&lt;/P&gt;
&lt;P&gt;Create a zip-file with an example structure.&lt;/P&gt;
&lt;P&gt;Then try to explain with text what you want to happen with your files in your zip..&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I think it will be a lot easier if we have an example to try with and have file with the right naming.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;/Rikard&lt;/P&gt;</description>
      <pubDate>Tue, 26 Sep 2017 19:00:40 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/find-next-part-number-using-vba/m-p/7410802#M97819</guid>
      <dc:creator>rikard.nilsson</dc:creator>
      <dc:date>2017-09-26T19:00:40Z</dc:date>
    </item>
  </channel>
</rss>

