Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
WCrihfield
in reply to: utm007

Oh, my mistake.  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.

So change this:

 

oMyMaterial = oMaterial

 

to this:

 

Set oMyMaterial = oMaterial

 

And change this:

 

oMyMaterial = oMaterial.CopyTo(pDoc)

 

to this:

 

Set oMyMaterial = oMaterial.CopyTo(pDoc)

 

 

Also...

Change the following line of code:

For Each oMaterial In ThisApplication.ActiveMaterialLibrary

to add the additional step at the end like this:

For Each oMaterial In ThisApplication.ActiveMaterialLibrary.MaterialAssets

I did not test it before posting it, because I knew I did not have a material by that name.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)