Previous Document Next Document

Object Model Reference : Classes : P : Palettes : Methods : Palettes.CreateFromSelection


Palettes.CreateFromSelection

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

Description

Member of Palettes

The CreateFromSelection method creates a new custom color palette based on the colors used in a selection of objects.

Parameter
Description
Name
Specifies the name of the new palette
FileName
Specifies the path and filename for the palette. This parameter is optional.
Overwrite
Specifies whether to overwrite the default palette. If this parameter is set to True, the new palette replaces the default palette. If it is set to False, the new palette coexists with the default palette. This parameter is optional, and its default value is False.

VBA example

The following VBA example displays the number of colors used in the selection.

Sub Test()
 Dim pal As Palette
 Set pal = Palettes.CreateFromSelection("Selection Colors", _
  Application.UserDataPath & "Palettes\SelectionColors.xml", True)
 MsgBox "The selection uses " & pal.ColorCount & " colors"
 pal.Close
End Sub

Previous Document Next Document Back to Top

Copyright 2013 Corel Corporation. All rights reserved.