Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
isocam
1409 Views, 4 Replies

Change Part Colour Using "RGB" Values

Can anybody help?

 

I am trying to set the colour of a part, via a VBA macro, using RGB Values.

 

Can someone try the following VBA macro on a Inventor part (ipt) document and let me know if you are getting the same error as me?

 

Public Function SetPartColour()
Dim oDoc As PartDocument

Set oDoc = ThisApplication.ActiveDocument

Dim color As ColorAssetValue

Set color = oDoc.ActiveAppearance.Item("generic_diffuse")

color.Value = ThisApplication.TransientObjects.CreateColor(Red, Green, Blue)
End Function

 

I get an error on the line highlighted in RED

 

Does anybody know how I can fix the error?

 

Many thanks in advance!!!!

 

Darren