PictureFormat.RestoreOriginalColors method (Publisher)
Restores the original colors of a picture that was recolored.
Syntax
expression.RestoreOriginalColors
expression A variable that represents a PictureFormat object.
Remarks
The RestoreOriginalColors method corresponds to the Restore Original Colors button in the Recolor Picture dialog box (Format menu > Picture > Recolor).
Example
The following Microsoft Visual Basic for Applications (VBA) macro shows how to use the RestoreOriginalColors method to restore the original colors of a picture that was recolored by using the Recolor method. It recolors the first shape in the Shapes collection on the first page of the publication and then restores its original colors.
For this example to work, the recolored shape must be either a picture or an OLE object that represents a picture.
Public Sub RestoreOriginalColors_Example()
Dim pubPictureFormat As Publisher.PictureFormat
Dim pubShape As Publisher.Shape
Dim pubColorFormat As Publisher.ColorFormat
Set pubShape = ThisDocument.Pages(1).Shapes(1)
Set pubPictureFormat = pubShape.PictureFormat
Set pubColorFormat = pubShape.Fill.BackColor
pubPictureFormat.Recolor pubColorFormat, msoTrue
MsgBox "Picture was recolored."
pubPictureFormat.RestoreOriginalColors
MsgBox "Original colors in picture were restored."
End Sub
Support and feedback
Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.