Excel 使用msoConnectorType创建虚线
我使用的excel宏当前在两个对象之间创建一条实线。我正在使用MsoConnectorStraight()。 如何创建虚线?microsoft文档中未对此进行说明 现在我是这样做的:Excel 使用msoConnectorType创建虚线,excel,vba,Excel,Vba,我使用的excel宏当前在两个对象之间创建一条实线。我正在使用MsoConnectorStraight()。 如何创建虚线?microsoft文档中未对此进行说明 现在我是这样做的: Set sheetGRAPHE = Sheets("GRAPHE") sheetGRAPHE.Select sheetGRAPHE.Cells.Select sheetGRAPHE.Shapes.AddConnector(msoConnectorStraight, 100, 100, 100,
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
可以将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 With