<?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: Material CHANGE in iLogic and VBA in Inventor Programming - iLogic, Macros, AddIns &amp; Apprentice</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/material-change-in-ilogic-and-vba/m-p/11194970#M138608</link>
    <description>&lt;P&gt;Hi &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/8675935"&gt;@utm007&lt;/a&gt;.&amp;nbsp; Try this version of your code.&amp;nbsp; This is in VBA, so it would be a VBA macro, and it would go into a regular 'Module'.&amp;nbsp; I'm just using that material name you were trying to use in your first post, so if that material does not exist, it will let you know, then exit the sub routine before trying to set it to the part.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;Sub ChangeMaterial()
    If ThisApplication.ActiveDocumentType &amp;lt;&amp;gt; kPartDocumentObject Then
        Call MsgBox("This VBA macro only works on Parts.", vbCritical, "Wrong Document Type")
        Exit Sub
    End If
    Dim pDoc As PartDocument
    Set pDoc = ThisApplication.ActiveDocument
    Dim oMaterialDisplayName As String
    oMaterialDisplayName = "TestMaterial"
    Dim oMyMaterial As MaterialAsset
    Dim oMaterial As MaterialAsset
    For Each oMaterial In pDoc.MaterialAssets
        If oMaterial.DisplayName = oMaterialDisplayName Then
            oMyMaterial = oMaterial
        End If
    Next
    If oMyMaterial Is Nothing Then
        For Each oMaterial In ThisApplication.ActiveMaterialLibrary
            If oMaterial.DisplayName = oMaterialDisplayName Then
                oMyMaterial = oMaterial.CopyTo(pDoc)
            End If
        Next
    End If
    If oMyMaterial Is Nothing Then
        Call MsgBox("The specified material was not found.", vbCritical, "")
        Exit Sub
    End If
    pDoc.ActiveMatrial = oMaterial
End Sub&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you need the iLogic version, you can pretty much just get rid of the 'Set' keywords, and the 'Call' keywords, and it will probably work just fine there.&lt;/P&gt;</description>
    <pubDate>Thu, 26 May 2022 14:08:40 GMT</pubDate>
    <dc:creator>WCrihfield</dc:creator>
    <dc:date>2022-05-26T14:08:40Z</dc:date>
    <item>
      <title>Material CHANGE in iLogic and VBA</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/material-change-in-ilogic-and-vba/m-p/11189677#M138453</link>
      <description>&lt;P&gt;Ciao,&lt;/P&gt;&lt;P&gt;I would like to change Material selection via VBA code.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I did even in iLogic and it works, code is :&lt;/P&gt;&lt;P&gt;[...]&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;iProperties&lt;/SPAN&gt;.&lt;SPAN&gt;Material&lt;/SPAN&gt; = &lt;SPAN&gt;"TestMaterial"&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;[...]&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In VBA i did:&lt;/P&gt;&lt;P&gt;[...]&lt;/P&gt;&lt;P&gt;ThisApplication.ActiveDocument.PropertySets.Item("Design Tracking Properties").Item("Material").Value = "TestMaterial"&lt;/P&gt;&lt;P&gt;[...]&lt;/P&gt;&lt;P&gt;In VBA i have no material change for the part.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I did the same for Custom iProperties and it works:&lt;/P&gt;&lt;P&gt;ThisApplication.ActiveDocument.PropertySets.Item("Inventor User Defined Properties").Item("InternalCode").Value = "TestCode"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can you help me? Any tips?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 24 May 2022 14:25:59 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/material-change-in-ilogic-and-vba/m-p/11189677#M138453</guid>
      <dc:creator>utm007</dc:creator>
      <dc:date>2022-05-24T14:25:59Z</dc:date>
    </item>
    <item>
      <title>Re: Material CHANGE in iLogic and VBA</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/material-change-in-ilogic-and-vba/m-p/11189735#M138456</link>
      <description>&lt;PRE&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;PartDocument&lt;/SPAN&gt;
&lt;SPAN&gt;Set&lt;/SPAN&gt; &lt;SPAN&gt;oDoc&lt;/SPAN&gt; = &lt;SPAN&gt;ThisApplication&lt;/SPAN&gt;.&lt;SPAN&gt;ActiveDocument&lt;/SPAN&gt;

&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oSM&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;SheetMetalComponentDefinition&lt;/SPAN&gt;
&lt;SPAN&gt;Set&lt;/SPAN&gt; &lt;SPAN&gt;oSM&lt;/SPAN&gt; = &lt;SPAN&gt;oDoc&lt;/SPAN&gt;.&lt;SPAN&gt;ComponentDefinition&lt;/SPAN&gt;

&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oSMStyle&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;SheetMetalStyle&lt;/SPAN&gt;
&lt;SPAN&gt;Set&lt;/SPAN&gt; &lt;SPAN&gt;oSMStyle&lt;/SPAN&gt; = &lt;SPAN&gt;oSM&lt;/SPAN&gt;.&lt;SPAN&gt;SheetMetalStyles&lt;/SPAN&gt;.&lt;SPAN&gt;Item&lt;/SPAN&gt;(&lt;SPAN&gt;"Default"&lt;/SPAN&gt;)
	
&lt;SPAN&gt;oSMStyle&lt;/SPAN&gt;.&lt;SPAN&gt;Activate&lt;/SPAN&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 24 May 2022 14:46:37 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/material-change-in-ilogic-and-vba/m-p/11189735#M138456</guid>
      <dc:creator>dalton98</dc:creator>
      <dc:date>2022-05-24T14:46:37Z</dc:date>
    </item>
    <item>
      <title>Re: Material CHANGE in iLogic and VBA</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/material-change-in-ilogic-and-vba/m-p/11190305#M138480</link>
      <description>&lt;P&gt;Hi &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/8675935"&gt;@utm007&lt;/a&gt;.&amp;nbsp; Although that iLogic shortcut snippet will work to easily change material, the actual iProperty's value is ReadOnly.&amp;nbsp; If you want to change the material of a part through VBA, you will most likely have to set a new value to the &lt;A href="https://help.autodesk.com/view/INVNTOR/2022/ENU/?guid=GUID-5953AE35-EBC2-4360-8094-188101F65355" target="_blank" rel="noopener"&gt;PartDocument.ActiveMaterial&lt;/A&gt; Property.&amp;nbsp; That is a Read/Write property, but it is wanting you to supply an &lt;A href="https://help.autodesk.com/view/INVNTOR/2022/ENU/?guid=GUID-9CD3F311-E5BD-4151-8EF9-8E9806A02609" target="_blank" rel="noopener"&gt;Asset&lt;/A&gt;, instead of just a material name.&amp;nbsp; To get the Asset, you need to find the one for that material either within the document's materials (&lt;A href="https://help.autodesk.com/view/INVNTOR/2022/ENU/?guid=GUID-FCA94271-5E1A-445D-AB1C-0CC64D0FC44C" target="_blank" rel="noopener"&gt;PartDocument.MaterialAssets&lt;/A&gt;) or one of the available material libraries (&lt;A href="https://help.autodesk.com/view/INVNTOR/2022/ENU/?guid=GUID-CD0ABECD-30B8-4E53-B434-3AE79798FAA0" target="_blank" rel="noopener"&gt;&lt;SPAN&gt;ThisApplication&lt;/SPAN&gt;.&lt;SPAN&gt;ActiveMaterialLibrary&lt;/SPAN&gt;&lt;/A&gt;).&amp;nbsp; There are other ways too, but this is the main way.&lt;/P&gt;</description>
      <pubDate>Tue, 24 May 2022 18:23:04 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/material-change-in-ilogic-and-vba/m-p/11190305#M138480</guid>
      <dc:creator>WCrihfield</dc:creator>
      <dc:date>2022-05-24T18:23:04Z</dc:date>
    </item>
    <item>
      <title>Re: Material CHANGE in iLogic and VBA</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/material-change-in-ilogic-and-vba/m-p/11194812#M138596</link>
      <description>&lt;P&gt;I've tried something like this, but can't set the ActiveMaterial I've retieve. Thanks&lt;/P&gt;&lt;LI-CODE lang="general"&gt;    Dim Doc As Document
    Dim pDoc As PartDocument
    Dim material As MaterialAsset
    
    Set Doc = ThisApplication.ActiveDocument
    Set pDoc = ThisApplication.ActiveDocument

   
    For Each material In Doc.MaterialAssets
    
        If material.IsUsed Then
     
        pDoc.ActiveMatrial = material.DisplayName '(??? I don't know how to set)
             
        Else
     
        End If

    Next&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 26 May 2022 13:17:21 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/material-change-in-ilogic-and-vba/m-p/11194812#M138596</guid>
      <dc:creator>utm007</dc:creator>
      <dc:date>2022-05-26T13:17:21Z</dc:date>
    </item>
    <item>
      <title>Re: Material CHANGE in iLogic and VBA</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/material-change-in-ilogic-and-vba/m-p/11194970#M138608</link>
      <description>&lt;P&gt;Hi &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/8675935"&gt;@utm007&lt;/a&gt;.&amp;nbsp; Try this version of your code.&amp;nbsp; This is in VBA, so it would be a VBA macro, and it would go into a regular 'Module'.&amp;nbsp; I'm just using that material name you were trying to use in your first post, so if that material does not exist, it will let you know, then exit the sub routine before trying to set it to the part.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;Sub ChangeMaterial()
    If ThisApplication.ActiveDocumentType &amp;lt;&amp;gt; kPartDocumentObject Then
        Call MsgBox("This VBA macro only works on Parts.", vbCritical, "Wrong Document Type")
        Exit Sub
    End If
    Dim pDoc As PartDocument
    Set pDoc = ThisApplication.ActiveDocument
    Dim oMaterialDisplayName As String
    oMaterialDisplayName = "TestMaterial"
    Dim oMyMaterial As MaterialAsset
    Dim oMaterial As MaterialAsset
    For Each oMaterial In pDoc.MaterialAssets
        If oMaterial.DisplayName = oMaterialDisplayName Then
            oMyMaterial = oMaterial
        End If
    Next
    If oMyMaterial Is Nothing Then
        For Each oMaterial In ThisApplication.ActiveMaterialLibrary
            If oMaterial.DisplayName = oMaterialDisplayName Then
                oMyMaterial = oMaterial.CopyTo(pDoc)
            End If
        Next
    End If
    If oMyMaterial Is Nothing Then
        Call MsgBox("The specified material was not found.", vbCritical, "")
        Exit Sub
    End If
    pDoc.ActiveMatrial = oMaterial
End Sub&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you need the iLogic version, you can pretty much just get rid of the 'Set' keywords, and the 'Call' keywords, and it will probably work just fine there.&lt;/P&gt;</description>
      <pubDate>Thu, 26 May 2022 14:08:40 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/material-change-in-ilogic-and-vba/m-p/11194970#M138608</guid>
      <dc:creator>WCrihfield</dc:creator>
      <dc:date>2022-05-26T14:08:40Z</dc:date>
    </item>
    <item>
      <title>Re: Material CHANGE in iLogic and VBA</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/material-change-in-ilogic-and-vba/m-p/11195093#M138616</link>
      <description>&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;it give me this Error.&lt;/P&gt;&lt;P&gt;I don't know how to fill in the value.&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="utm007_0-1653576691674.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1072362iA825327213D6EA62/image-size/medium?v=v2&amp;amp;px=400" role="button" title="utm007_0-1653576691674.png" alt="utm007_0-1653576691674.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;</description>
      <pubDate>Thu, 26 May 2022 14:52:02 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/material-change-in-ilogic-and-vba/m-p/11195093#M138616</guid>
      <dc:creator>utm007</dc:creator>
      <dc:date>2022-05-26T14:52:02Z</dc:date>
    </item>
    <item>
      <title>Re: Material CHANGE in iLogic and VBA</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/material-change-in-ilogic-and-vba/m-p/11195101#M138617</link>
      <description>&lt;P&gt;Oh, my mistake.&amp;nbsp; I forgot to add the 'Set' keyword at the start of those two lines of code, because they are setting a value to the variable.&lt;/P&gt;
&lt;P&gt;So change this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;oMyMaterial = oMaterial&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;to this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;Set oMyMaterial = oMaterial&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And change this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;oMyMaterial = oMaterial.CopyTo(pDoc)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;to this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;Set oMyMaterial = oMaterial.CopyTo(pDoc)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also...&lt;/P&gt;
&lt;P&gt;Change the following line of code:&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;For Each oMaterial In ThisApplication.ActiveMaterialLibrary&lt;/LI-CODE&gt;
&lt;P&gt;to add the additional step at the end like this:&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;For Each oMaterial In ThisApplication.ActiveMaterialLibrary.MaterialAssets&lt;/LI-CODE&gt;
&lt;P&gt;I did not test it before posting it, because I knew I did not have a material by that name.&lt;/P&gt;</description>
      <pubDate>Thu, 26 May 2022 14:59:28 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/material-change-in-ilogic-and-vba/m-p/11195101#M138617</guid>
      <dc:creator>WCrihfield</dc:creator>
      <dc:date>2022-05-26T14:59:28Z</dc:date>
    </item>
    <item>
      <title>Re: Material CHANGE in iLogic and VBA</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/material-change-in-ilogic-and-vba/m-p/11195123#M138618</link>
      <description>&lt;P&gt;Here is the corrected full code again, since I made so many hasty mistakes the first time.&amp;nbsp; This time I created a material by that name, then tested it out and fixed the code properly so that it worked in my tests.&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;Sub ChangeMaterial()
    If ThisApplication.ActiveDocumentType &amp;lt;&amp;gt; kPartDocumentObject Then
        Call MsgBox("This VBA macro only works on Parts.", vbCritical, "Wrong Document Type")
        Exit Sub
    End If
    Dim pDoc As PartDocument
    Set pDoc = ThisApplication.ActiveDocument
    Dim oMaterialDisplayName As String
    oMaterialDisplayName = "TestMaterial"
    Dim oMyMaterial As MaterialAsset
    Dim oMaterial As MaterialAsset
    For Each oMaterial In pDoc.MaterialAssets
        If oMaterial.DisplayName = oMaterialDisplayName Then
            Set oMyMaterial = oMaterial
        End If
    Next
    If oMyMaterial Is Nothing Then
        For Each oMaterial In ThisApplication.ActiveMaterialLibrary.MaterialAssets
            If oMaterial.DisplayName = oMaterialDisplayName Then
                Set oMyMaterial = oMaterial.CopyTo(pDoc)
            End If
        Next
    End If
    If oMyMaterial Is Nothing Then
        Call MsgBox("The specified material was not found.", vbCritical, "")
        Exit Sub
    End If
    pDoc.ActiveMaterial = oMyMaterial
End Sub&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 26 May 2022 15:06:25 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/material-change-in-ilogic-and-vba/m-p/11195123#M138618</guid>
      <dc:creator>WCrihfield</dc:creator>
      <dc:date>2022-05-26T15:06:25Z</dc:date>
    </item>
    <item>
      <title>Re: Material CHANGE in iLogic and VBA</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/material-change-in-ilogic-and-vba/m-p/12312719#M159190</link>
      <description>&lt;P&gt;Had some issues with the code you guys had wrote, my brother does a lot of coding and helped me write this:&lt;/P&gt;&lt;P&gt;Works great!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;Dim assetLib As AssetLibrary&amp;nbsp; = ThisApplication.AssetLibraries.Item("Inventor Material Library")&lt;/DIV&gt;&lt;DIV&gt;ThisApplication.ActiveMaterialLibrary = assetLib&lt;/DIV&gt;&lt;DIV&gt;mat = InputBox("Material", "Change Part Material")&lt;/DIV&gt;&lt;DIV&gt;userChoice = InputRadioBox("Defined the scope", "This Document", "All Open Documents", True, Title := "Defined the scope")&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;If userChoice Then&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;iProperties.Material = mat&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;Else&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;For Each pDoc As PartDocument In ThisApplication.Documents.VisibleDocuments&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;If ThisApplication.ActiveDocumentType &amp;lt;&amp;gt; kPartDocumentObject Then&lt;/DIV&gt;&lt;DIV&gt;Call MsgBox("This VBA macro only works on Parts.", vbCritical, "Wrong Document Type")&lt;/DIV&gt;&lt;DIV&gt;Continue For&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;End If&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Dim MaterialName As String&lt;/DIV&gt;&lt;DIV&gt;MaterialName = mat&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Try&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; Dim localMaterial As MaterialAsset = pDoc.MaterialAssets.Item(MaterialName)&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Catch&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; Dim libMaterial As MaterialAsset = assetLib.MaterialAssets.Item(MaterialName)&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; libMaterial.CopyTo(pDoc)&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;End Try&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Try&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; pDoc.ActiveMaterial = pDoc.MaterialAssets.Item(MaterialName)&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Catch ex As Exception&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; Call MsgBox("Failed to set material, Error:" &amp;amp; ex.message, vbCritical, "Error")&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;End Try&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Next&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;End If&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 17 Oct 2023 21:47:18 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/material-change-in-ilogic-and-vba/m-p/12312719#M159190</guid>
      <dc:creator>Luke.NashWU9MY</dc:creator>
      <dc:date>2023-10-17T21:47:18Z</dc:date>
    </item>
  </channel>
</rss>

