<?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: Multi Delete or Change Linked Excel from all parts using Ilogic Rule in Inventor Programming - iLogic, Macros, AddIns &amp; Apprentice</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/multi-delete-or-change-linked-excel-from-all-parts-using-ilogic/m-p/10019559#M120230</link>
    <description>&lt;P&gt;I've never tried it before, but you can try this iLogic rule.&lt;/P&gt;&lt;P&gt;It is only designed to replace the source Excel file (assumes one exists), and doesn't try to delete it.&lt;/P&gt;&lt;P&gt;You didn't specify what conditions you want to check for when you would prefer to delete it instead of replace it.&lt;/P&gt;&lt;P&gt;Here's the iLogic code:&lt;/P&gt;&lt;P&gt;(Lines starting with an apostrophe (') are just comments, and don't effect the result of the rule.)&lt;/P&gt;&lt;LI-CODE lang="general"&gt;If ThisApplication.ActiveDocumentType &amp;lt;&amp;gt; DocumentTypeEnum.kAssemblyDocumentObject Then
	MsgBox("An Assembly Document must be active for this rule (" &amp;amp; iLogicVb.RuleName &amp;amp; ") to work. Exiting.",vbOKOnly+vbCritical, "WRONG DOCUMENT TYPE")
	Exit Sub
End If
Dim oADoc As AssemblyDocument = ThisApplication.ActiveDocument
Dim oADef As AssemblyComponentDefinition = oADoc.ComponentDefinition
oADef.re
For Each oRefDoc As Document In oADoc.AllReferencedDocuments
	'checking its type
	If oRefDoc.DocumentType &amp;lt;&amp;gt; DocumentTypeEnum.kAssemblyDocumentObject And _
		oRefDoc.DocumentType &amp;lt;&amp;gt; DocumentTypeEnum.kPartDocumentObject Then
		Continue For 'skip to the next oRefDoc
	End If
	'make this the 'active' document temporarily,
	'so the following method will hopefully work on it, instead of the main assembly
	oRefDoc.Activate
	'if you specify an empty string for the first name, it will replace any reference that is currently there
	'replace the second name with the path and name of your new excel file.
	Dim oChanged As Boolean = GoExcel.ChangeSourceOfLinked("", "C:\Temp\NewExelReference.xlsx")
	'it will be True if it succeeded
	If oChanged = False Then
		MsgBox("It failed to change the source Excel file for:" &amp;amp; vbCrLf &amp;amp; _
		oRefDoc.FullFileName,vbOKOnly+vbInformation,"")
	End If
Next&lt;/LI-CODE&gt;&lt;P&gt;There is likely a better way to check for this link, but since I rarely attempt to manage it by code, I haven't seen another way yet.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If this solved your problem, or answered your question, please click &lt;SPAN style="background-color: green; color: white;"&gt;&lt;STRONG&gt;ACCEPT SOLUTION&lt;/STRONG&gt;&lt;/SPAN&gt;.&lt;BR /&gt;Or, if this helped you, please click (LIKE or KUDOS) &lt;SPAN&gt;&lt;img class="lia-deferred-image lia-image-emoji" src="https://forums.autodesk.com/html/@7401B55A0A518861312A0F851CD29320/emoticons/1f44d.png" alt=":thumbs_up:" title=":thumbs_up:" /&gt;&lt;/SPAN&gt;.&lt;/P&gt;&lt;P&gt;If you have time, please... Vote For &lt;A href="https://forums.autodesk.com/t5/forums/recentpostspage/post-type/message/interaction-style/idea/user-id/7812054/" target="_blank"&gt;My IDEAS &lt;SPAN&gt;&lt;img class="lia-deferred-image lia-image-emoji" src="https://forums.autodesk.com/html/@B166FEBB95D67CFA84899D32D8E17FC1/emoticons/1f4a1.png" alt=":light_bulb:" title=":light_bulb:" /&gt;&lt;/SPAN&gt;&lt;/A&gt;or you can Explore &lt;A href="https://knowledge.autodesk.com/profile/LTSUSR7HXMSAE/articles" target="_blank"&gt;My CONTRIBUTIONS &lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://help.autodesk.com/view/INVNTOR/2021/ENU/" target="_blank"&gt;Inventor 2021 Help &lt;/A&gt;| &lt;A href="https://forums.autodesk.com/t5/inventor-forum/bd-p/78/" target="_blank"&gt;Inventor Forum &lt;/A&gt;| &lt;A href="https://forums.autodesk.com/t5/inventor-customization/bd-p/120/" target="_blank"&gt;Inventor Customization Forum &lt;/A&gt;| &lt;A href="https://forums.autodesk.com/t5/inventor-ideas/idb-p/v1232/" target="_blank"&gt;Inventor Ideas Forum &lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 21 Jan 2021 14:06:38 GMT</pubDate>
    <dc:creator>WCrihfield</dc:creator>
    <dc:date>2021-01-21T14:06:38Z</dc:date>
    <item>
      <title>Multi Delete or Change Linked Excel from all parts using Ilogic Rule</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/multi-delete-or-change-linked-excel-from-all-parts-using-ilogic/m-p/10019283#M120222</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;BR /&gt;I want to create a rule to delete or change the excel file linked in all parts. Run it on the top assembly, and then automatically it will delete/change the linked file (Excel) in every single part and sub assemblys.&lt;/P&gt;&lt;P&gt;I believe de code is this:&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;changeOK&lt;/SPAN&gt; = &lt;SPAN&gt;GoExcel&lt;/SPAN&gt;.&lt;SPAN&gt;ChangeSourceOfLinked&lt;/SPAN&gt;(&lt;SPAN&gt;partialOldName&lt;/SPAN&gt;, &lt;SPAN&gt;newName&lt;/SPAN&gt;)&lt;/PRE&gt;&lt;P&gt;*I don't understand nothing aboud coding...&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;</description>
      <pubDate>Thu, 21 Jan 2021 12:22:53 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/multi-delete-or-change-linked-excel-from-all-parts-using-ilogic/m-p/10019283#M120222</guid>
      <dc:creator>filipapinto</dc:creator>
      <dc:date>2021-01-21T12:22:53Z</dc:date>
    </item>
    <item>
      <title>Re: Multi Delete or Change Linked Excel from all parts using Ilogic Rule</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/multi-delete-or-change-linked-excel-from-all-parts-using-ilogic/m-p/10019559#M120230</link>
      <description>&lt;P&gt;I've never tried it before, but you can try this iLogic rule.&lt;/P&gt;&lt;P&gt;It is only designed to replace the source Excel file (assumes one exists), and doesn't try to delete it.&lt;/P&gt;&lt;P&gt;You didn't specify what conditions you want to check for when you would prefer to delete it instead of replace it.&lt;/P&gt;&lt;P&gt;Here's the iLogic code:&lt;/P&gt;&lt;P&gt;(Lines starting with an apostrophe (') are just comments, and don't effect the result of the rule.)&lt;/P&gt;&lt;LI-CODE lang="general"&gt;If ThisApplication.ActiveDocumentType &amp;lt;&amp;gt; DocumentTypeEnum.kAssemblyDocumentObject Then
	MsgBox("An Assembly Document must be active for this rule (" &amp;amp; iLogicVb.RuleName &amp;amp; ") to work. Exiting.",vbOKOnly+vbCritical, "WRONG DOCUMENT TYPE")
	Exit Sub
End If
Dim oADoc As AssemblyDocument = ThisApplication.ActiveDocument
Dim oADef As AssemblyComponentDefinition = oADoc.ComponentDefinition
oADef.re
For Each oRefDoc As Document In oADoc.AllReferencedDocuments
	'checking its type
	If oRefDoc.DocumentType &amp;lt;&amp;gt; DocumentTypeEnum.kAssemblyDocumentObject And _
		oRefDoc.DocumentType &amp;lt;&amp;gt; DocumentTypeEnum.kPartDocumentObject Then
		Continue For 'skip to the next oRefDoc
	End If
	'make this the 'active' document temporarily,
	'so the following method will hopefully work on it, instead of the main assembly
	oRefDoc.Activate
	'if you specify an empty string for the first name, it will replace any reference that is currently there
	'replace the second name with the path and name of your new excel file.
	Dim oChanged As Boolean = GoExcel.ChangeSourceOfLinked("", "C:\Temp\NewExelReference.xlsx")
	'it will be True if it succeeded
	If oChanged = False Then
		MsgBox("It failed to change the source Excel file for:" &amp;amp; vbCrLf &amp;amp; _
		oRefDoc.FullFileName,vbOKOnly+vbInformation,"")
	End If
Next&lt;/LI-CODE&gt;&lt;P&gt;There is likely a better way to check for this link, but since I rarely attempt to manage it by code, I haven't seen another way yet.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If this solved your problem, or answered your question, please click &lt;SPAN style="background-color: green; color: white;"&gt;&lt;STRONG&gt;ACCEPT SOLUTION&lt;/STRONG&gt;&lt;/SPAN&gt;.&lt;BR /&gt;Or, if this helped you, please click (LIKE or KUDOS) &lt;SPAN&gt;&lt;img class="lia-deferred-image lia-image-emoji" src="https://forums.autodesk.com/html/@7401B55A0A518861312A0F851CD29320/emoticons/1f44d.png" alt=":thumbs_up:" title=":thumbs_up:" /&gt;&lt;/SPAN&gt;.&lt;/P&gt;&lt;P&gt;If you have time, please... Vote For &lt;A href="https://forums.autodesk.com/t5/forums/recentpostspage/post-type/message/interaction-style/idea/user-id/7812054/" target="_blank"&gt;My IDEAS &lt;SPAN&gt;&lt;img class="lia-deferred-image lia-image-emoji" src="https://forums.autodesk.com/html/@B166FEBB95D67CFA84899D32D8E17FC1/emoticons/1f4a1.png" alt=":light_bulb:" title=":light_bulb:" /&gt;&lt;/SPAN&gt;&lt;/A&gt;or you can Explore &lt;A href="https://knowledge.autodesk.com/profile/LTSUSR7HXMSAE/articles" target="_blank"&gt;My CONTRIBUTIONS &lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://help.autodesk.com/view/INVNTOR/2021/ENU/" target="_blank"&gt;Inventor 2021 Help &lt;/A&gt;| &lt;A href="https://forums.autodesk.com/t5/inventor-forum/bd-p/78/" target="_blank"&gt;Inventor Forum &lt;/A&gt;| &lt;A href="https://forums.autodesk.com/t5/inventor-customization/bd-p/120/" target="_blank"&gt;Inventor Customization Forum &lt;/A&gt;| &lt;A href="https://forums.autodesk.com/t5/inventor-ideas/idb-p/v1232/" target="_blank"&gt;Inventor Ideas Forum &lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Jan 2021 14:06:38 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/multi-delete-or-change-linked-excel-from-all-parts-using-ilogic/m-p/10019559#M120230</guid>
      <dc:creator>WCrihfield</dc:creator>
      <dc:date>2021-01-21T14:06:38Z</dc:date>
    </item>
  </channel>
</rss>

