在循环中,前三个命令是成功的。 但不是循环的第四行 - 那里有一个错误。 我们能够为outlineShape设置属性但是焊接有什么问题?
Dim outlineShape As Shape
Dim weldShape As Shape
For Each s In sr
Set outlineShape = s.Outline.ConvertToObject
outlineShape.Fill.UniformColor.CMYKAssign 100, 0, 0, 0
s.Fill.UniformColor.CMYKAssign 0, 0, 0, 50
' Set weldShape = outlineShape.Weld(s) ' error here! Method Weld of object IDrawShape failed
' in debagger, the line shows: The referenced object no loger exist in the document
Next s
答案 0 :(得分:0)
使用corel x6正常工作。
Sub test()
Dim outlineShape As Shape
Dim weldShape As Shape
Dim s As Shape
For Each s In ActiveDocument.ActiveLayer.Shapes
Set outlineShape = s.Outline.ConvertToObject
outlineShape.Fill.UniformColor.CMYKAssign 100, 0, 0, 0
s.Fill.UniformColor.CMYKAssign 0, 0, 0, 50
Set weldShape = outlineShape.Weld(s)
Next s
End Sub
尝试将s声明为Shape,将sr
更改为“shape array”。
我认为,问题在于你的sr
对象不是你需要的类型。