API Documentation > CorelDRAW > 2025-v26 > StructPaletteOptions > IVGStructPaletteOptions
StructPaletteOptions.NumColors property
Syntax:
Property Get NumColors() As Long
Property Let NumColors(ByVal Value As Long)
Remarks:
The NumColors property specifies the maximum number of colors that can be added to the image palette. (The actual number of colors may be less than the specified number.)
Examples:
The following VBA example exports the image using a 16-color optimized palette:
Sub Test()
Dim pal As New StructPaletteOptions
Dim flt As ExportFilter
pal.NumColors = 16
pal.PaletteType = cdrPaletteOptimized
Set flt = ActiveDocument.ExportBitmap("C:\Temp\img.gif", cdrGIF, , cdrPalettedImage, PaletteOptions:=pal)
flt.Finish 
End Sub