A frequently used color assignment for elements is "from level", meaning an item is displayed in the color assigned to the layer containing the element.
When choosing colors for the levels (0 to 255), any RGB values can be supplied, not just those on the color table. This can bring up printing problems when the pen tables alter colors and the RGB values are not identified.
Therefore, it may be best to modify all RGB colors of levels of specific indexes to the color table while maintaining the original color.
To find the closest possible color in the color table, there is a useful VBA method called ".InternalColorToIndexedcOLOR".
To lump modify all colors of the levels to index colors, you can use the following approach:
Dim oLv As Level
For Each oLv In ActiveDesignFile.Levels
If Not oLv.IsFromLevelLibrary Then
oLv.ElementColor = ActiveModelReference.InternalColorToIndexedColor(oLv.ElementColor)