|
- Sub test1()
- Dim arr1()
- On Error GoTo 100
- arr = Application.InputBox("在工作表中选择XY坐标数组", "选择区域", Type:=8)
- n = Application.CountA(arr) / 2
- ReDim arr1(1 To n)
- arr1 = Application.Transpose(arr)
- Set myDocument = Worksheets(1)
- With myDocument.Shapes.BuildFreeform(msoEditingAuto, _
- Application.Transpose(arr1(2, 1)), _
- Application.Transpose(arr1(1, 1)))
- For i = 2 To n - 1
- ar1 = Application.Transpose(arr1(2, i))
- ar2 = Application.Transpose(arr1(1, i))
- .AddNodes msoSegmentLine, msoEditingAuto, ar1, ar2
- Next
- cctype = Application.InputBox("图块输入:0" & Chr(10) & "线条输入:1", "", 0)
- If cctype = 0 Then
- .AddNodes msoSegmentLine, msoEditingAuto, _
- Application.Transpose(arr1(2, 1)), _
- Application.Transpose(arr1(1, 1))
- ' .ConvertToShape
- .ConvertToShape.Select
- Selection.ShapeRange().Rotation = -90
- With Selection.ShapeRange.Fill
- ' .Visible = msoTrue
- .ForeColor.RGB = RGB(255, 66, 102)
- .Transparency = 0
- .Solid
- End With
- ElseIf cctype = 1 Then
- .AddNodes msoSegmentLine, msoEditingAuto, _
- Application.Transpose(arr1(2, n)), _
- Application.Transpose(arr1(1, n))
- ' .ConvertToShape
- .ConvertToShape.Select
- Selection.ShapeRange().Rotation = -90
- End If
- .Shapes.Range.Left = 300
- .Shapes.Range.Top = 800
- End With
- 100:
- End Sub
复制代码 |
|