![]() |
#1
|
|||
|
|||
![]()
Suppose I have a word and the letters are different colours. How can I pull out the string for those coloured orange (CreateCMYKColor(0, 60, 100, 0)). I know how to process letters in a word one at a time but I'm looking to find strings of the same colour. Thanks
|
#2
|
|||
|
|||
![]()
Well the following seems to be working but there must be a better way and I would like to know how to search for a colour without using it's name, eg Brown Old is cmyk(0,20,20,50)
Code:
Sub UpdateTextColour() Dim wrd As String, t As String, s as Shape, p as Page For Each p In ActiveDocument.pages For Each s In p.Shapes If s.Type = cdrTextShape Then n = s.text.Story.Length wrd = s.text.Story For i = 0 To n - 1 n = 0 If s.text.Range(i, i + 1).Fill.UniformColor.name = "Brown Old" Then n = 1 If s.text.Range(i + 1, i + 2).Fill.UniformColor.name = "Brown Old" Then n = 2 If s.text.Range(i + 1, i + 3).Fill.UniformColor.name = "Brown Old" Then n = 3 If s.text.Range(i + 1, i + 4).Fill.UniformColor.name = "Brown Old" Then n = 4 End If End If End If If n > 0 Then t = s.text.Range(i, i + n) choice = MsgBox("YES: Brown" + Chr(13) + Chr(13) + " No: Grey", vbYesNo, "Select Colour of " + t + " in " + wrd) If choice = vbYes Then s.text.Range(i, i + n).Fill.UniformColor.CMYKAssign 10, 80, 90, 40 If choice = vbNo Then s.text.Range(i, i + n).Fill.UniformColor.CMYKAssign 0, 0, 0, 80 i = i + n End If Next End If Next s Next p MsgBox "Done!" End Sub |
![]() |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Document.FullFileName return empty string | coreldrawer | Macros/Add-ons | 0 | 15-05-2013 08:19 |
Return Focus to Text Box | cooloox | CorelDRAW/Corel DESIGNER VBA | 4 | 31-03-2009 04:25 |
Randomising a text string | knowbodynow | CorelDRAW/Corel DESIGNER VBA | 3 | 07-05-2006 08:15 |
Changing Colour of Characters in Artistic text | knowbodynow | CorelDRAW/Corel DESIGNER VBA | 3 | 06-05-2006 20:43 |
how do return architectural measurements in text box? | xombie | CorelDRAW/Corel DESIGNER VBA | 4 | 15-03-2006 09:43 |