我正在使用一个excel宏,它当前在两个对象之间创建一条实线。我正在使用MsoConnectorStraight (https://docs.microsoft.com/en-us/dotnet/api/microsoft.office.core.msoconnectortype?view=office-pia)。如何创建虚线?microsoft文档中没有说明这一点。
现在我是这样做的:
Set sheetGRAPHE = Sheets("GRAPHE")
sheetGRAPHE.Select
sheetGRAPHE.Cells.Select
sheetGRAPHE.Shapes.AddConnector(msoConnectorStraight, 100, 100, 100, 100).Name = ConnectID //Produces a straight line
sheetGRAPHE.Shapes(ConnectID).Line.ForeColor.RGB = RGB(250, 0, 0)
sheetGRAPHE.Shapes(ConnectID).Line.Weight = 1发布于 2020-10-07 20:08:28
可以将LineFormat对象的DashStyle属性设置为msoLineSysDot。
sheetGRAPHE.Shapes(ConnectID).Line.DashStyle = msoLineSysDot但是,您的代码可以重写如下...
Dim sheetGRAPHE As Worksheet
Set sheetGRAPHE = Sheets("GRAPHE")
Dim shp As Shape
Set shp = sheetGRAPHE.Shapes.AddConnector(msoConnectorStraight, 100, 100, 100, 100)
With shp
.Name = ConnectID
With .Line
.DashStyle = msoLineSysDot
.ForeColor.RGB = RGB(250, 0, 0)
.Weight = 1
End With
End Withhttps://stackoverflow.com/questions/64242721
复制相似问题