如何调整弯头连接器的宽度?

时间:2018-08-28 14:08:09

标签: excel vba excel-vba line arrows

请注意,在以下代码中,箭头表示从形状底部突出的箭头。对于需要作出决定的情况,我还创建了一个侧箭头(在代码中标识为Sarw)。请注意,对于侧箭头,我将其指定为连接器。我这样做是因为我看不到在弯头连接器上的线上有任何调整。当我尝试在代码中调整弯头连接器的宽度时,我没有成功。我不懂为什么。可以提供的任何帮助将不胜感激。谢谢!

 'This first part places arrows on the bottom of a shape

 If rng.Offset(, 4).Value = " "
 GoTo Line1 'I wrote this part for when VBA expects a number & gets a blank
 End If

 Set arw = ws2.Shapes.AddLine(BegX, BegY, EndX, EndY)
 With arw
     .Line.BeginArrowheadStyle = msoArrowheadTriangle
     .Line.BeginArrowheadWidth = msoArrowheadWide
     .Line.ForeColor.RGB = RGB(0, 0, 0)

 End With


 'The following part is for the side arrows
 If rng.Offset(, 8).Value = " " Then
 GoTo Line2

 End If
 Set Sarw = ws2.Shapes.AddConnector(msoConnectorElbow, SBegX, SBegY, SEndX, SEndY)

 With Sarw

     .Line.BeginArrowheadStyle = msoArrowheadTriangle
     .Line.BeginArrowheadWidth = msoArrowheadWide
     .Line.ForeColor.RGB = RGB(0, 0, 0)
     .Adjustments.Item(1) = 45

 End With

2 个答案:

答案 0 :(得分:0)

这似乎对我有用。我看不到您的代码中有什么可以做的事吗?

Sub Macro1()

Dim s As Shape

Set s = ActiveSheet.Shapes.AddConnector(msoConnectorElbow, 10, 10, 50, 50)

s.Line.Weight = 5

End Sub

答案 1 :(得分:0)

SJR ...我尝试了您的方法。除非我有误会,否则这似乎会调整线的粗细。请注意,如果将权重从5更改为90,则该线看起来更像一个矩形。我将附上一张图片,以演示我想要达到的效果。我希望这有帮助。如果我误解了您的例子,请告诉我。谢谢!

Click here for example