02-19-2021
12:29 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
02-19-2021
12:29 AM
I tried to do it with VBA but same problem.
I noticed that there is a difference in the signature of CopyTo between VBA and the API doc.
API
ReplaceExisting: Optional input Boolean that specifies whether replace the existing asset if an asset of the same name exists.
VBA
So I tried this
Dim docMaterial As MaterialAsset
Set docMaterial = ThisDocument.ActiveMaterial
Dim libMaterial As MaterialAsset
Set libMaterial = ThisApplication.ActiveMaterialLibrary.MaterialAssets.Item(docMaterial.DisplayName)
Set docMaterial = libMaterial.CopyTo(ThisDocument.MaterialAssets, docMaterial)
and this
Dim docMaterial As asset // <-- why does this always turn to lower case?
Set docMaterial = ThisDocument.ActiveMaterial
Dim libMaterial As asset
Set libMaterial = ThisApplication.ActiveMaterialLibrary.MaterialAssets.Item(docMaterial.DisplayName)
Set docMaterial = libMaterial.CopyTo(ThisDocument.Assets, docMaterial)
and this (as desribed in the API docs)
Set docMaterial = libMaterial.CopyTo(ThisDocument.Assets, True)
and it always chrashes at CopyTo.
How can I update a existing MaterialAsset from a library?
Thanks,
Christoph