<?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: Error in iLogic in Inventor Programming - iLogic, Macros, AddIns &amp; Apprentice</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/error-in-ilogic/m-p/10253830#M123492</link>
    <description>&lt;P&gt;i have reinstalled excel, reinstalled inventor 2021. Nothing seems to bring this helpfull tool back to life. Don't know where to look further...&lt;/P&gt;&lt;P&gt;On my collegues PC it runs without any issue.&lt;/P&gt;</description>
    <pubDate>Tue, 20 Apr 2021 14:34:23 GMT</pubDate>
    <dc:creator>johan.degreef</dc:creator>
    <dc:date>2021-04-20T14:34:23Z</dc:date>
    <item>
      <title>Error in iLogic</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/error-in-ilogic/m-p/10248478#M123429</link>
      <description>&lt;P&gt;All of the sudden this iLogic code gives an error. What i did: I did install Vsual studio to try to learn to code, and therefore I needed to install .net framework 4.8. That is what I have changed. I work on Inventor 2021. I guess it is since then then error pops up.&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="Knipsel.JPG" style="width: 721px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/908327i10E0291B4F03DB78/image-size/large?v=v2&amp;amp;px=999" role="button" title="Knipsel.JPG" alt="Knipsel.JPG" /&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;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;Imports System.IO
GetInput :

Dim Filename As String = "C:\Autodesk en Templates\PTN_Part_Library\New_PTN_Part_Library.xlsx"



Dim ExcelApp As Object
Dim opened As Boolean
Dim wb As Object
Dim Six_Digit As String

ExcelApp = GetObject(, "Excel.Application")
opened = False

For Each wb In ExcelApp.workbooks
	If UCase(wb.fullname) = UCase(Filename) Then
		opened = True
		Exit For
	End If
Next

If Not opened Then
	GoExcel.Open("C:\Autodesk en Templates\PTN_Part_Library\New_PTN_Part_Library.xlsx")
	'GoExcel.Open("C:\Users\ef\Desktop\New_PTN_Part_Library.xlsx")
End If

Six_Digit = ExcelApp.ActiveCell.Value

If Six_Digit = "" Then
            Return
Else If Len(Six_Digit) &amp;lt;&amp;gt; "6" Then
MessageBox.Show("Input must be 6 digits", "ilogic")
GoTo GetInput

End If



Dim oDoc As Document
Dim sFilename As String

'hard code path
oLibrary_Folder = "C:\Autodesk en Templates\PTN_Part_Library\"


Dim oFilenames() As String
oFilenames = System.IO.Directory.GetFiles(oLibrary_Folder, _
"*.*", SearchOption.AllDirectories)

For Each oFilename As String In oFilenames
            Dim oFileNameNoExt As String = System.IO.Path.GetFileNameWithoutExtension(oFilename)
            If oFileNameNoExt.Contains(Six_Digit) AndAlso oFileNameNoExt.Length = 11 Then
                        Dim oOptions As Inventor.NameValueMap
                        oOptions = ThisApplication.TransientObjects.CreateNameValueMap
                        oDoc = ThisApplication.Documents.OpenWithOptions(oFilename, oOptions, False)
                        sFilename = oFilename
                        Exit For
            End If
Next

If sFilename = "" Then
            MessageBox.Show("No matching libary file found.", "iLogic")
            Return
End If

'path from current file
Dim oActiveAssemblyfolder As String = ThisDoc.Path &amp;amp; "\"




'find the postion of the last backslash in the path
Dim FNamePos As Integer = InStrRev(sFilename, "\", -1)
'get the file name with the file extension
Dim oName As String = Right(sFilename, Len(sFilename) -FNamePos)
'get the file name (without extension)
Dim ShortName As String = Left(oName, Len(oName) -4)
'get extension
Dim oExt As String = Right(oName, 4)


Dim oNewName As String = ShortName &amp;amp; "_" &amp;amp; System.DateTime.Now.ToString("yyyyMdHHmmss")

Dim oPathandName As String = oActiveAssemblyfolder &amp;amp; oNewName &amp;amp; oExt

oDoc.PropertySets.Item("Design Tracking Properties").Item("Part Number").Value = ShortName
'save new document
oDoc.SaveAs(oPathandName, True)
oDoc.Close

'[ Place Component
Dim oAsmCompDef As AssemblyComponentDefinition
oAsmCompDef = ThisApplication.ActiveDocument.ComponentDefinition



' Create Matrix
Dim oMatrix As Matrix
oMatrix = ThisApplication.TransientGeometry.CreateMatrix
Call oMatrix.SetTranslation(ThisApplication.TransientGeometry.CreateVector(50, 50, 50), True)



'insert new occurence
'Dim oOcc As ComponentOccurrence
'oOcc = oAsmCompDef.Occurrences.Add( _
'oPathandName, oMatrix)

ThisApplication.CommandManager.PostPrivateEvent(PrivateEventTypeEnum.kFileNameEvent, oPathandName)
ThisApplication.CommandManager.ControlDefinitions.Item("AssemblyPlaceComponentCmd").Execute&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 18 Apr 2021 16:15:31 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/error-in-ilogic/m-p/10248478#M123429</guid>
      <dc:creator>johan.degreef</dc:creator>
      <dc:date>2021-04-18T16:15:31Z</dc:date>
    </item>
    <item>
      <title>Re: Error in iLogic</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/error-in-ilogic/m-p/10248647#M123430</link>
      <description>&lt;P&gt;&lt;A href="https://www.google.com/url?sa=t&amp;amp;source=web&amp;amp;rct=j&amp;amp;url=https://social.msdn.microsoft.com/Forums/sqlserver/en-US/4dedfd8a-d411-4f76-8951-955f1237334e/net-activex-component-failing-after-net-48-upgrade%3Fforum%3Dnetfxbcl&amp;amp;ved=2ahUKEwjC_a3at4jwAhXE2aQKHR2_Bj4QFjAAegQIBRAC&amp;amp;usg=AOvVaw2mmzVu78ag2nqHSyKhjRwp" target="_blank"&gt;https://www.google.com/url?sa=t&amp;amp;source=web&amp;amp;rct=j&amp;amp;url=https://social.msdn.microsoft.com/Forums/sqlserver/en-US/4dedfd8a-d411-4f76-8951-955f1237334e/net-activex-component-failing-after-net-48-upgrade%3Fforum%3Dnetfxbcl&amp;amp;ved=2ahUKEwjC_a3at4jwAhXE2aQKHR2_Bj4QFjAAegQIBRAC&amp;amp;usg=AOvVaw2mmzVu78ag2nqHSyKhjRwp&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 18 Apr 2021 18:39:26 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/error-in-ilogic/m-p/10248647#M123430</guid>
      <dc:creator>bradeneuropeArthur</dc:creator>
      <dc:date>2021-04-18T18:39:26Z</dc:date>
    </item>
    <item>
      <title>Re: Error in iLogic</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/error-in-ilogic/m-p/10248654#M123431</link>
      <description>&lt;P&gt;Try to uninstall 4.8! Think that you don't need that for testing your code!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 18 Apr 2021 18:42:04 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/error-in-ilogic/m-p/10248654#M123431</guid>
      <dc:creator>bradeneuropeArthur</dc:creator>
      <dc:date>2021-04-18T18:42:04Z</dc:date>
    </item>
    <item>
      <title>Re: Error in iLogic</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/error-in-ilogic/m-p/10249369#M123436</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/473476"&gt;@bradeneuropeArthur&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I think i deleted all 4.8 stuff, but still not working. Now there is 5.0 too and some ASP.NET stuff.&lt;/P&gt;&lt;P&gt;Can that be safely deleted too?&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="Knipsel.JPG" style="width: 354px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/908460iB0AEAF9BF92ABE98/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Knipsel.JPG" alt="Knipsel.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Apr 2021 05:24:59 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/error-in-ilogic/m-p/10249369#M123436</guid>
      <dc:creator>johan.degreef</dc:creator>
      <dc:date>2021-04-19T05:24:59Z</dc:date>
    </item>
    <item>
      <title>Re: Error in iLogic</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/error-in-ilogic/m-p/10249438#M123437</link>
      <description>&lt;P&gt;Create a restore point first.&lt;/P&gt;
&lt;P&gt;Normally you can uninstall that without issues.&lt;/P&gt;
&lt;P&gt;If not restore your machine to the restore point.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Apr 2021 06:08:07 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/error-in-ilogic/m-p/10249438#M123437</guid>
      <dc:creator>bradeneuropeArthur</dc:creator>
      <dc:date>2021-04-19T06:08:07Z</dc:date>
    </item>
    <item>
      <title>Betreff: Error in iLogic</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/error-in-ilogic/m-p/10249500#M123439</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The GetObject method gives correct an error if Excel is simply not running and the PathName argument is omitted. Simply add an empty string and GetObject creates a new Excel.Application instance.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;ExcelApp = GetObject("", "Excel.Application")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This way is not possible if you want to use a running instance. You can use a try-catch statement&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Try
	ExcelApp = GetObject(, "Excel.Application")
	For Each wb In ExcelApp.workbooks
		If UCase(wb.fullname) = UCase(Filename) Then
			Exit For
		End If
	Next
Catch
	GoExcel.Open("C:\Autodesk en Templates\PTN_Part_Library\New_PTN_Part_Library.xlsx")
	'GoExcel.Open("C:\Users\ef\Desktop\New_PTN_Part_Library.xlsx")
End Try&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;or an On Error Resume next.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;On Error Resume Next

ExcelApp = GetObject(, "Excel.Application")
opened = False

For Each wb In ExcelApp.workbooks
	If UCase(wb.fullname) = UCase(Filename) Then
		opened = True
		Exit For
	End If
Next

If Not opened Then
	GoExcel.Open("C:\Autodesk en Templates\PTN_Part_Library\New_PTN_Part_Library.xlsx")
	'GoExcel.Open("C:\Users\ef\Desktop\New_PTN_Part_Library.xlsx")
End If

On Error GoTo 0&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Apr 2021 06:48:38 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/error-in-ilogic/m-p/10249500#M123439</guid>
      <dc:creator>Ralf_Krieg</dc:creator>
      <dc:date>2021-04-19T06:48:38Z</dc:date>
    </item>
    <item>
      <title>Betreff: Error in iLogic</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/error-in-ilogic/m-p/10249799#M123443</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/564136"&gt;@Ralf_Krieg&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thx, but I tried both option, giving other errors.&lt;/P&gt;&lt;P&gt;This code was working fine.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;There is always an instance open of excel (the sheet where I pick my number)&lt;/P&gt;</description>
      <pubDate>Mon, 19 Apr 2021 09:00:34 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/error-in-ilogic/m-p/10249799#M123443</guid>
      <dc:creator>johan.degreef</dc:creator>
      <dc:date>2021-04-19T09:00:34Z</dc:date>
    </item>
    <item>
      <title>Re: Error in iLogic</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/error-in-ilogic/m-p/10253830#M123492</link>
      <description>&lt;P&gt;i have reinstalled excel, reinstalled inventor 2021. Nothing seems to bring this helpfull tool back to life. Don't know where to look further...&lt;/P&gt;&lt;P&gt;On my collegues PC it runs without any issue.&lt;/P&gt;</description>
      <pubDate>Tue, 20 Apr 2021 14:34:23 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/error-in-ilogic/m-p/10253830#M123492</guid>
      <dc:creator>johan.degreef</dc:creator>
      <dc:date>2021-04-20T14:34:23Z</dc:date>
    </item>
    <item>
      <title>Re: Error in iLogic</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/error-in-ilogic/m-p/10254159#M123498</link>
      <description>&lt;P&gt;Do you have show fileextensions on?&lt;/P&gt;</description>
      <pubDate>Tue, 20 Apr 2021 16:11:15 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/error-in-ilogic/m-p/10254159#M123498</guid>
      <dc:creator>bradeneuropeArthur</dc:creator>
      <dc:date>2021-04-20T16:11:15Z</dc:date>
    </item>
    <item>
      <title>Re: Error in iLogic</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/error-in-ilogic/m-p/10254372#M123503</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/473476"&gt;@bradeneuropeArthur&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;&lt;P&gt;Do you have show fileextensions on?&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/473476"&gt;@bradeneuropeArthur&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;&lt;P&gt;Do you have show fileextensions on?&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;no&lt;/P&gt;</description>
      <pubDate>Tue, 20 Apr 2021 17:33:38 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/error-in-ilogic/m-p/10254372#M123503</guid>
      <dc:creator>johan.degreef</dc:creator>
      <dc:date>2021-04-20T17:33:38Z</dc:date>
    </item>
    <item>
      <title>Re: Error in iLogic</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/error-in-ilogic/m-p/10254383#M123504</link>
      <description>&lt;P&gt;It must have something to do with user rights, because if I run inventor as adminsitrator, it works. But I cannot do that all the time, because of access rights to sharded network drives.&lt;/P&gt;</description>
      <pubDate>Tue, 20 Apr 2021 17:39:33 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/error-in-ilogic/m-p/10254383#M123504</guid>
      <dc:creator>johan.degreef</dc:creator>
      <dc:date>2021-04-20T17:39:33Z</dc:date>
    </item>
    <item>
      <title>Re: Error in iLogic</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/error-in-ilogic/m-p/10254522#M123505</link>
      <description>&lt;P&gt;Try it with fileextensions on!&lt;/P&gt;</description>
      <pubDate>Tue, 20 Apr 2021 18:30:03 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/error-in-ilogic/m-p/10254522#M123505</guid>
      <dc:creator>bradeneuropeArthur</dc:creator>
      <dc:date>2021-04-20T18:30:03Z</dc:date>
    </item>
    <item>
      <title>Re: Error in iLogic</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/error-in-ilogic/m-p/10254523#M123506</link>
      <description>&lt;P&gt;Can you share the complete code.&lt;BR /&gt;Including the add references!&lt;/P&gt;</description>
      <pubDate>Tue, 20 Apr 2021 18:30:52 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/error-in-ilogic/m-p/10254523#M123506</guid>
      <dc:creator>bradeneuropeArthur</dc:creator>
      <dc:date>2021-04-20T18:30:52Z</dc:date>
    </item>
    <item>
      <title>Re: Error in iLogic</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/error-in-ilogic/m-p/10254570#M123507</link>
      <description>&lt;P&gt;Changed:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;Imports System.IO
GetInput :

Dim Filename As String = "C:\Autodesk en Templates\PTN_Part_Library\New_PTN_Part_Library.xlsx"



Dim ExcelApp As Object
Dim opened As Boolean
Dim wb As Object
Dim Six_Digit As String

ExcelApp = GetObject("", "Excel.Application")
opened = False

For Each wb In ExcelApp.workbooks
	If UCase(wb.fullname) = UCase(Filename) Then
		opened = True
		Exit For
	End If
Next

If Not opened Then
	GoExcel.Open("C:\Autodesk en Templates\PTN_Part_Library\New_PTN_Part_Library.xlsx")
	'GoExcel.Open("C:\Users\ef\Desktop\New_PTN_Part_Library.xlsx")
End If

Six_Digit = ExcelApp.ActiveCell.Value

If Six_Digit = "" Then
            Return
Else If Len(Six_Digit) &amp;lt;&amp;gt; "6" Then
MessageBox.Show("Input must be 6 digits", "ilogic")
GoTo GetInput

End If



Dim oDoc As Document
Dim sFilename As String

'hard code path
oLibrary_Folder = "C:\Autodesk en Templates\PTN_Part_Library\"


Dim oFilenames() As String
oFilenames = System.IO.Directory.GetFiles(oLibrary_Folder, _
"*.*", SearchOption.AllDirectories)

For Each oFilename As String In oFilenames
            Dim oFileNameNoExt As String = System.IO.Path.GetFileNameWithoutExtension(oFilename)
            If oFileNameNoExt.Contains(Six_Digit) AndAlso oFileNameNoExt.Length = 11 Then
                        Dim oOptions As Inventor.NameValueMap
                        oOptions = ThisApplication.TransientObjects.CreateNameValueMap
                        oDoc = ThisApplication.Documents.OpenWithOptions(oFilename, oOptions, False)
                        sFilename = oFilename
                        Exit For
            End If
Next

If sFilename = "" Then
            MessageBox.Show("No matching libary file found.", "iLogic")
            Return
End If

'path from current file
Dim oActiveAssemblyfolder As String = ThisDoc.Path &amp;amp; "\"




'find the postion of the last backslash in the path
Dim FNamePos As Integer = InStrRev(sFilename, "\", -1)
'get the file name with the file extension
Dim oName As String = Right(sFilename, Len(sFilename) -FNamePos)
'get the file name (without extension)
Dim ShortName As String = Left(oName, Len(oName) -4)
'get extension
Dim oExt As String = Right(oName, 4)


Dim oNewName As String = ShortName &amp;amp; "_" &amp;amp; System.DateTime.Now.ToString("yyyyMdHHmmss")

Dim oPathandName As String = oActiveAssemblyfolder &amp;amp; oNewName &amp;amp; oExt

oDoc.PropertySets.Item("Design Tracking Properties").Item("Part Number").Value = ShortName
'save new document
oDoc.SaveAs(oPathandName, True)
oDoc.Close

'[ Place Component
Dim oAsmCompDef As AssemblyComponentDefinition
oAsmCompDef = ThisApplication.ActiveDocument.ComponentDefinition



' Create Matrix
Dim oMatrix As Matrix
oMatrix = ThisApplication.TransientGeometry.CreateMatrix
Call oMatrix.SetTranslation(ThisApplication.TransientGeometry.CreateVector(50, 50, 50), True)



'insert new occurence
'Dim oOcc As ComponentOccurrence
'oOcc = oAsmCompDef.Occurrences.Add( _
'oPathandName, oMatrix)

ThisApplication.CommandManager.PostPrivateEvent(PrivateEventTypeEnum.kFileNameEvent, oPathandName)
ThisApplication.CommandManager.ControlDefinitions.Item("AssemblyPlaceComponentCmd").Execute&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 20 Apr 2021 18:44:31 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/error-in-ilogic/m-p/10254570#M123507</guid>
      <dc:creator>bradeneuropeArthur</dc:creator>
      <dc:date>2021-04-20T18:44:31Z</dc:date>
    </item>
    <item>
      <title>Re: Error in iLogic</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/error-in-ilogic/m-p/10256386#M123526</link>
      <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="bradeneuropeArthur_0-1619006601866.png" style="width: 400px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/909630i6DFAC6688C6EA5B1/image-size/medium?v=v2&amp;amp;px=400" role="button" title="bradeneuropeArthur_0-1619006601866.png" alt="bradeneuropeArthur_0-1619006601866.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Did that help?&lt;/P&gt;</description>
      <pubDate>Wed, 21 Apr 2021 12:03:36 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/error-in-ilogic/m-p/10256386#M123526</guid>
      <dc:creator>bradeneuropeArthur</dc:creator>
      <dc:date>2021-04-21T12:03:36Z</dc:date>
    </item>
    <item>
      <title>Re: Error in iLogic</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/error-in-ilogic/m-p/10256479#M123527</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/473476"&gt;@bradeneuropeArthur&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="bradeneuropeArthur_0-1619006601866.png" style="width: 400px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/909630i6DFAC6688C6EA5B1/image-size/medium?v=v2&amp;amp;px=400" role="button" title="bradeneuropeArthur_0-1619006601866.png" alt="bradeneuropeArthur_0-1619006601866.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Did that help?&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;No&lt;/P&gt;</description>
      <pubDate>Wed, 21 Apr 2021 12:31:56 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/error-in-ilogic/m-p/10256479#M123527</guid>
      <dc:creator>johan.degreef</dc:creator>
      <dc:date>2021-04-21T12:31:56Z</dc:date>
    </item>
    <item>
      <title>Re: Error in iLogic</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/error-in-ilogic/m-p/10256519#M123528</link>
      <description>&lt;P&gt;Test dit eens:&lt;/P&gt;
&lt;P&gt;Welke messages krijg je:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;Imports System.IO
GetInput :

Dim Filename As String = "C:\Autodesk en Templates\PTN_Part_Library\New_PTN_Part_Library.xlsx"



Dim ExcelApp As Object
Dim opened As Boolean
Dim wb As Object
Dim Six_Digit As String

Msgbox ("A")

ExcelApp = GetObject("", "Excel.Application")
opened = False
Msgbox ("B")

For Each wb In ExcelApp.workbooks
	If UCase(wb.fullname) = UCase(Filename) Then
		opened = True
		Msgbox ("C")
		Exit For
	End If
Next

If Not opened Then
	GoExcel.Open("C:\Autodesk en Templates\PTN_Part_Library\New_PTN_Part_Library.xlsx")
	'GoExcel.Open("C:\Users\ef\Desktop\New_PTN_Part_Library.xlsx")

	Msgbox ("D")

Six_Digit = ExcelApp.ActiveCell.Value

Msgbox ("Excel six Digit " &amp;amp; Six_Digit)

If Six_Digit = "" Then
            Return
Else If Len(Six_Digit) &amp;lt;&amp;gt; "6" Then
MessageBox.Show("Input must be 6 digits", "ilogic")
GoTo GetInput

End If



Dim oDoc As Document
Dim sFilename As String

'hard code path
oLibrary_Folder = "C:\Autodesk en Templates\PTN_Part_Library\"


Dim oFilenames() As String
oFilenames = System.IO.Directory.GetFiles(oLibrary_Folder, _
"*.*", SearchOption.AllDirectories)

Msgbox ("E ")
For Each oFilename As String In oFilenames
            Dim oFileNameNoExt As String = System.IO.Path.GetFileNameWithoutExtension(oFilename)
            If oFileNameNoExt.Contains(Six_Digit) AndAlso oFileNameNoExt.Length = 11 Then
                        Dim oOptions As Inventor.NameValueMap
                        oOptions = ThisApplication.TransientObjects.CreateNameValueMap
                        oDoc = ThisApplication.Documents.OpenWithOptions(oFilename, oOptions, False)
                        sFilename = oFilename
                        Exit For
            End If
Next

If sFilename = "" Then
            MessageBox.Show("No matching libary file found.", "iLogic")
            Return
End If

'path from current file
Dim oActiveAssemblyfolder As String = ThisDoc.Path &amp;amp; "\"



Msgbox ("F ")
'find the postion of the last backslash in the path
Dim FNamePos As Integer = InStrRev(sFilename, "\", -1)
'get the file name with the file extension
Dim oName As String = Right(sFilename, Len(sFilename) -FNamePos)
'get the file name (without extension)
Dim ShortName As String = Left(oName, Len(oName) -4)
'get extension
Dim oExt As String = Right(oName, 4)

Msgbox ("G ")
Dim oNewName As String = ShortName &amp;amp; "_" &amp;amp; System.DateTime.Now.ToString("yyyyMdHHmmss")

Dim oPathandName As String = oActiveAssemblyfolder &amp;amp; oNewName &amp;amp; oExt

Msgbox ("H ")

oDoc.PropertySets.Item("Design Tracking Properties").Item("Part Number").Value = ShortName
'save new document
oDoc.SaveAs(oPathandName, True)
oDoc.Close

Msgbox ("I")

'[ Place Component
Dim oAsmCompDef As AssemblyComponentDefinition
oAsmCompDef = ThisApplication.ActiveDocument.ComponentDefinition


Msgbox ("J ")
' Create Matrix
Dim oMatrix As Matrix
oMatrix = ThisApplication.TransientGeometry.CreateMatrix
Call oMatrix.SetTranslation(ThisApplication.TransientGeometry.CreateVector(50, 50, 50), True)


Msgbox ("K ")
'insert new occurence
'Dim oOcc As ComponentOccurrence
'oOcc = oAsmCompDef.Occurrences.Add( _
'oPathandName, oMatrix)
Msgbox ("L ")
ThisApplication.CommandManager.PostPrivateEvent(PrivateEventTypeEnum.kFileNameEvent, oPathandName)
ThisApplication.CommandManager.ControlDefinitions.Item("AssemblyPlaceComponentCmd").Execute
Msgbox ("M ")&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 21 Apr 2021 12:45:03 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/error-in-ilogic/m-p/10256519#M123528</guid>
      <dc:creator>bradeneuropeArthur</dc:creator>
      <dc:date>2021-04-21T12:45:03Z</dc:date>
    </item>
    <item>
      <title>Re: Error in iLogic</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/error-in-ilogic/m-p/10256946#M123532</link>
      <description>&lt;P&gt;"A", and then it crashes&lt;/P&gt;</description>
      <pubDate>Wed, 21 Apr 2021 14:49:44 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/error-in-ilogic/m-p/10256946#M123532</guid>
      <dc:creator>johan.degreef</dc:creator>
      <dc:date>2021-04-21T14:49:44Z</dc:date>
    </item>
    <item>
      <title>Re: Error in iLogic</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/error-in-ilogic/m-p/10256975#M123533</link>
      <description>&lt;P&gt;first start excel.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;than run the code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What messages do you get now?&lt;/P&gt;</description>
      <pubDate>Wed, 21 Apr 2021 14:56:01 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/error-in-ilogic/m-p/10256975#M123533</guid>
      <dc:creator>bradeneuropeArthur</dc:creator>
      <dc:date>2021-04-21T14:56:01Z</dc:date>
    </item>
    <item>
      <title>Re: Error in iLogic</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/error-in-ilogic/m-p/10257509#M123543</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/473476"&gt;@bradeneuropeArthur&lt;/a&gt;&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/564136"&gt;@Ralf_Krieg&lt;/a&gt;&amp;nbsp;I always start excel first. The intention of the ilogic code is to select an excel cell with a 6 digit number in,&amp;nbsp; so the result is an "A"&lt;/P&gt;&lt;P&gt;I don't think the problem lies in the code. It has to do with user rights or installation of excel/inventor. But I can't find what.&lt;/P&gt;</description>
      <pubDate>Wed, 21 Apr 2021 18:33:26 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/error-in-ilogic/m-p/10257509#M123543</guid>
      <dc:creator>johan.degreef</dc:creator>
      <dc:date>2021-04-21T18:33:26Z</dc:date>
    </item>
  </channel>
</rss>

