我正在尝试选择当前选择中某种颜色的所有颜色
我使用以下方法找出选择中的所有颜色
Dim s As Shape
Dim value As String, os As ShapeRange
Set os = ActiveSelectionRange
If os.Count < 1 Then MsgBox ("Nothing selected!"): Exit Sub
For Each s In os
value = s.Fill.UniformColor.ToString
MsgBox (value)
Next s
问题是字符串的值如下
CMYK,USER,0,84,80,100,000000000-0000-0000-0000-0000-00000000000
我需要提取第二个和第六个逗号之间的4位数字,以便获得cmyk的颜色,然后我可以使用该颜色来查找形状
我一直在寻找有关VB中字符串操作的想法,但它们似乎是针对excel而不是coreldraw
任何想法?
任何帮助表示赞赏
标记
答案 0 :(得分:0)
Split
是本机VBA函数,如@RCL所述。请尝试以下示例:
Sub Test()
Dim s As Shape
Dim value As String
Dim os As ShapeRange
Dim tmp
Set os = ActiveSelectionRange
If os.Count < 1 Then MsgBox ("Nothing selected!"): Exit Sub
For Each s In os
value = s.Fill.UniformColor.ToString
tmp = Split(value, ",")
MsgBox tmp(2) & vbCrLf & tmp(3) & vbCrLf & tmp(4) & vbCrLf & tmp(5)
Next s
End Sub