VBA插入形状组合问题
我写了一个宏,在ppt中插入几个形状并组合,宏如果连续执行就会出现问题,问题出现在组合的代码上,请帮忙看看是什么原因,十分感谢!Public Sub 反应条件()
Dim MPoint_X, MPoint_Y As Long
Dim Num_shapes As Long
ScreenUpdating = False
MPoint_X = 400: MPoint_Y = 200
Num_shapes = ActiveWindow.Selection.SlideRange.Shapes.Count
ActiveWindow.Selection.SlideRange.Shapes.AddLine(MPoint_X - 40, MPoint_Y, MPoint_X + 40, MPoint_Y).Select
With ActiveWindow.Selection
.ShapeRange.Name = "shp" & Num_shapes + 1
.ShapeRange.Line.ForeColor.RGB = RGB(Red_N, Green_N, Blue_N)
.ShapeRange.Line.Weight = 1.5
End With
ActiveWindow.Selection.SlideRange.Shapes.AddLine(MPoint_X - 40, MPoint_Y + 5, MPoint_X + 40, MPoint_Y + 5).Select
With ActiveWindow.Selection
.ShapeRange.Name = "shp" & Num_shapes + 2
.ShapeRange.Line.ForeColor.RGB = RGB(Red_N, Green_N, Blue_N)
.ShapeRange.Line.Weight = 1.5
End With
ActiveWindow.Selection.SlideRange.Shapes.AddLine(MPoint_X - 10, MPoint_Y - 5, MPoint_X + 10, MPoint_Y - 5).Select
With ActiveWindow.Selection
.ShapeRange.Name = "shp" & Num_shapes + 3
.ShapeRange.Line.ForeColor.RGB = RGB(Red_N, Green_N, Blue_N)
.ShapeRange.Line.Weight = 1.5
End With
ActiveWindow.Selection.SlideRange.Shapes.AddLine(MPoint_X - 10, MPoint_Y - 5, MPoint_X, MPoint_Y - 25).Select
With ActiveWindow.Selection
.ShapeRange.Name = "shp" & Num_shapes + 4
.ShapeRange.Line.ForeColor.RGB = RGB(Red_N, Green_N, Blue_N)
.ShapeRange.Line.Weight = 1.5
End With
ActiveWindow.Selection.SlideRange.Shapes.AddLine(MPoint_X, MPoint_Y - 25, MPoint_X + 10, MPoint_Y - 5).Select
With ActiveWindow.Selection
.ShapeRange.Name = "shp" & Num_shapes + 5
.ShapeRange.Line.ForeColor.RGB = RGB(Red_N, Green_N, Blue_N)
.ShapeRange.Line.Weight = 1.5
End With
ActiveWindow.Selection.SlideRange.Shapes.Range(Array("shp" & Num_shapes + 1, "shp" & Num_shapes + 2, "shp" & Num_shapes + 3, "shp" & Num_shapes + 4, "shp" & Num_shapes + 5)).Select
ActiveWindow.Selection.ShapeRange.Group.Select
End Sub
页:
[1]