Previous Document Next Document
Palettes.CreateFromDocument

Function CreateFromDocument(Name As String, [FileName As String], [Overwrite As Boolean = False]) As Palette

Member of Palettes

The CreateFromDocument method creates a new custom color palette based on the colors used in the active document.

Parameters
Description
Name
Assigns a name to the new palette
FileName
Assigns a path and filename to the palette
This parameter is optional.
Overwrite
If set to True, the new palette replaces the default palette. If set to False, the new palette coexists with the default palette.
This parameter is optional, and its default value is False.

The following code example displays the number of colors used in the active document:

Sub Test() 
 Dim pal As Palette 
 Set pal = Palettes.CreateFromDocument("Document Colors", _ 
  Application.UserDataPath & "Palettes\DocColors.cpl", True) 
 MsgBox "The document uses " & pal.ColorCount & " colors" 
 pal.Close 
End Sub 

Previous Document Next Document Back to Top

Copyright 2007 Corel Corporation. All rights reserved.