OberonPlace.com Forums  

Go Back   OberonPlace.com Forums > Developer Forums > VBA > CorelDRAW/Corel DESIGNER VBA

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 08-12-2020, 06:39
clausm clausm is offline
Junior Member
 
Join Date: Mar 2004
Posts: 16
Default ActiveShape.Fill.UniformColor.Name

Hello to everybody from Germany!

I have a custom color palette with a color named "Transparent", see image attached

In Corel DRAW 2017 I could get the name of the color with:
ActiveShape.Fill.UniformColor.Name

In DRAW 2020 this does not work anymore.
In 2020 the result of ActiveShape.Fill.UniformColor.Name is "unbenannte farbe" (german for "unnamed color").

i don't know, in wich version this behaviour changed.
Does anybody can confirm this bug (or isn't it a bug?) or has an idea, how I can geht the name of the color in DRAW 2020.

Thanks in advance
Claus
Attached Images
 
Reply With Quote
  #2  
Old 16-05-2021, 22:36
shelbym's Avatar
shelbym shelbym is offline
Senior Member
 
Join Date: Nov 2002
Location: Cheyenne, WY
Posts: 1,788
Blog Entries: 12
Send a message via ICQ to shelbym Send a message via AIM to shelbym Send a message via MSN to shelbym Send a message via Yahoo to shelbym
Default ActiveShape.Fill.UniformColor.Name

Yep, looks to be a bug. No matter what color I use it always returns "unnamed color". I do not have a work around, if I find one I will let you know.

I will also get this logged.

-Shelby
Reply With Quote
  #3  
Old 03-09-2021, 21:52
shelbym's Avatar
shelbym shelbym is offline
Senior Member
 
Join Date: Nov 2002
Location: Cheyenne, WY
Posts: 1,788
Blog Entries: 12
Send a message via ICQ to shelbym Send a message via AIM to shelbym Send a message via MSN to shelbym Send a message via Yahoo to shelbym
Default ActiveShape.Fill.UniformColor.Name

This was asked on the Corel Community Forum so I decided to revisit it and see if I could figure out a work around. If you want to see that entire thread you may see it here:

Color Name not recognised in Color Label Macro in 2021

If you just want the code, then here here an example of a workaround. :-)

Code:
Sub LabelSwatches()
    Dim sr As ShapeRange, sh As Shape, cn As Shape, col As Color, pal As Palette

    ActiveDocument.Unit = cdrInch

    Set sr = ActiveSelectionRange

    If sr.Count = 0 Then MsgBox "Nothing selected!": Exit Sub

    ActiveDocument.BeginCommandGroup "ColorsNames"
        For Each sh In sr
            Set col = sh.Fill.UniformColor
            Set pal = col.Palette
            
            Set cn = ActiveDocument.ActiveLayer.CreateArtisticText(sh.CenterX, sh.CenterY + (sh.SizeHeight / 2.5), pal.Color(pal.GetIndexOfColor(col)).Name & vbCr & col.Name(True), cdrEnglishUS, , "Arial", sh.SizeWidth / 0.18, , , , cdrCenterAlignment)
            cn.Fill.ApplyUniformFill CreateCMYKColor(0, 0, 0, 0)
        Next sh
    ActiveDocument.EndCommandGroup
End Sub
Happy Coding,

-Shelby
Reply With Quote
Reply

Tags
color name uniformcolor


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Select Same Outline, Fill, Outline & Fill 2018 dungbtl CorelDRAW/Corel DESIGNER VBA 1 05-07-2019 07:42
Fill Problem noj General 0 26-06-2014 00:18
Find the layer of the activeshape knowbodynow CorelDRAW/Corel DESIGNER VBA 3 22-01-2011 09:17
Curious 'With Shape.Fill.UniformColor' Bug RobC CorelDRAW/Corel DESIGNER VBA 2 18-11-2008 19:17
Fill Combo Box Shaddy CorelDRAW/Corel DESIGNER VBA 1 25-07-2006 10:10


All times are GMT -5. The time now is 22:02.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.
Copyright © 2011, Oberonplace.com