myparam = InputBox("Enter Coating Name", "Custom iProperty - Coating", )
Dim oAssy As AssemblyDocument = ThisApplication.ActiveDocument
Dim oRefDoc As Document
For Each oRefDoc In oAssy.AllReferencedDocuments
If Not oRefDoc.ComponentDefinition.BOMStructure = kNormalBOMStructure Then Continue For
If Not oRefDoc.DocumentType = kPartDocumentObject Then Continue For
If oRefDoc.PropertySets.Item(3).Item("Material").Value = "Aluminum 6061"
Try
'custom iproperty exists
oRefDoc.PropertySets.Item(4).Item("Coating").Value = myparam
Catch
'custom iproperty doesn't exist
oRefDoc.PropertySets.Item(4).Add(myparam, "Coating")
End Try
End If
Next