View Single Post
  #1  
Old 13-12-2011, 11:00
ashishbindal93
Guest
 
Posts: n/a
Default Need help spliting strings in coreldraw

HI,
I am new to vba and trying to write a simple color picker code which stores the "activeshape.Fill.UniformColor.ToString" into a string variable.

Then i need to break the color components from the saved color and get them in different variables.

Can anyone help me out?Please..

my code:

Dim q As Double, w As Double, p As Double, colcount As Double, shr As ShapeRange, _
mycols() As String, mycolsname() As String

Private Sub update_pal()

p = 1: q = 0: w = 0: Set shr = Nothing

If colcount > 0 Then
For w = 1 To colcount
mycols(w) = ""
Next w

For w = 1 To colcount
mycolsname(w) = ""
Next w
End If

q = ActiveSelectionRange.shapes.count
Set shr = ActiveSelectionRange

For w = 1 To q
If shr.shapes.Item(w).Fill.Type = cdrUniformFill Then
ReDim Preserve mycols(1 To p)
ReDim Preserve mycolsname(1 To p)
mycols(p) = shr.shapes.Item(w).Fill.UniformColor.ToString
mycolsname(p) = shr.shapes.Item(w).Fill.UniformColor.Name
p = p + 1
End If
Next w
colcount = p - 1

For w = 1 To p - 1
MsgBox mycols(w) + mycolsname(w)
Next w


End Sub

Private Sub UserForm_Initialize()
colcount = 0
update_pal
End Sub

Output:

msgbox:


CMYK,USER,0,100,100,0


I want to store this CMYK seperately and the cmyk values seperately

Last edited by ashishbindal93; 13-12-2011 at 11:08.
Reply With Quote