[VBA] How to change the property of a line of a shape

P

Peter Müller

Each of the following line produces an error which tells me the value is
not inside the allowed range:

myShape.Line.Weight=1
myShape.Line.ForeColor.RGB=0
i=myShape.Line.ForeColor.RGB
i=myShape.Line.ForeColor.Type

Has anyone a clue what's going on?
 
S

Steve Rindsberg

Peter Müller said:
Each of the following line produces an error which tells me the value is
not inside the allowed range:

myShape.Line.Weight=1
myShape.Line.ForeColor.RGB=0
i=myShape.Line.ForeColor.RGB
i=myShape.Line.ForeColor.Type

Has anyone a clue what's going on?

I don't think you've posted enough of the original code to be sure what's
going on. This works in 2007 when I've selected a line or rectangle. Same
as yours, more or less.

Sub thing()
Dim oSh As Shape
Set oSh = ActiveWindow.Selection.ShapeRange(1)
Dim i As Long

oSh.Line.Weight = 1
oSh.Line.ForeColor.RGB = 0
i = oSh.Line.ForeColor.RGB
i = oSh.Line.ForeColor.Type
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top