GDG Code Chunks, Discussion, VBA Snippets for CorelDRAW, Simple Macro Helpers!

cool vba macros for corel show cart gdg corel draw macros checkoutMyAccount corel macros
VBA Corel Macro Help
john's macros
thanks for stopping by gdg macros















Helpful VBA Code

<<Back to helpful code list

Find and replace colors, Even in powerclips

Decription: This is a simple find and replace script. It works by selecting the first color you want replaced with the first click and the second color you want to replace it with, with the second click. Comment out the msgbox lines once you become comfortable with it.

Date: 2010-05-04 Author: John

Code:
Option Explicit


Sub replaceColorsGDG()

Dim col As New Color, col2 As New Color
Dim orig As Shape, smith As Shape
Dim s As Shape, sp As Shape
Dim pwc As PowerClip
Dim x As Double, y As Double
Dim Shift As Long
Dim a As Boolean, b As Boolean

 
 MsgBox "Select shape with the color you need replace", , "GDG"
 a = False
 While Not a
  a = ActiveDocument.GetUserClick(x, y, Shift, 10, False, cdrCursorEyeDrop)
  If Not a Then
        Set orig = ActivePage.SelectShapesAtPoint(x, y, False)
        col.CopyAssign orig.Fill.UniformColor
        ActiveDocument.ClearSelection
        GoTo 1001
    End If
 Wend
1001:
MsgBox "Select shape with the color you need applied", , "GDG"

 b = False
 While Not b
  b = ActiveDocument.GetUserClick(x, y, Shift, 10, False, cdrCursorEyeDrop)
  If Not b Then
        Set smith = ActivePage.SelectShapesAtPoint(x, y, False)
        col2.CopyAssign smith.Fill.UniformColor
        ActiveDocument.ClearSelection
        GoTo 1002
    End If
 Wend
1002:

For Each s In ActivePage.FindShapes
    If s.Fill.Type = cdrUniformFill Or Not s.PowerClip Is Nothing Then
        Set pwc = Nothing
        On Error Resume Next
        Set pwc = s.PowerClip
        On Error GoTo 0
        If Not pwc Is Nothing Then
            
            For Each sp In pwc.Shapes
            'sp.CreateSelection
            If sp.Fill.Type = cdrUniformFill Then
                If sp.Fill.UniformColor.IsSame(col) Then '
                    sp.Fill.ApplyUniformFill col2
                End If
            End If
        Next sp
        Else
            If s.Fill.UniformColor.IsSame(col) Then '
                s.Fill.ApplyUniformFill col2
            End If
        End If
    End If
Next s


End Sub


Title: Please suggest code for outline
Comment left by: mhn
Date: 2014-09-10
Comment left:
Very useful piece of code.
Please suggest code to change outline as well.

Thanks.



gdg


Title: Doesnt work on outline
Comment left by: dika van uki
Date: 2014-07-03
Comment left:
Please add code for outline too thanks john



gdg


Title: working with symbols
Comment left by: bmoney
Date: 2013-07-03
Comment left:
does this work within symbols linked throughout a document?



gdg




Next Last


corel macros boost workflow
*Searches the FREE and Commercial Macros


GDG Macros for CorelDraw 2025
\
CorelDraw macros for version 2024

CorelDraw macros for version 2023

CorelDraw macros for version 2022

CorelDraw macros for version 2020

CorelDraw macros for version 2019

CorelDraw macros for version 2018

CorelDraw macros for version 2017

macros for coreldraw x8

macros for coreldraw x7

macros for corel draw x6

macros for corel draw x6

FIND IT ON

find it on yahoo

FIND IT ON

find it on google