ExcelHome技术论坛

 找回密码
 免费注册

QQ登录

只需一步,快速开始

快捷登录

搜索
EH技术汇-专业的职场技能充电站 妙哉!函数段子手趣味讲函数 Excel服务器-会Excel,做管理系统 Excel Home精品图文教程库
HR薪酬管理数字化实战 Excel 2021函数公式学习大典 Excel数据透视表实战秘技 打造核心竞争力的职场宝典
300集Office 2010微视频教程 数据工作者的案头书 免费直播课集锦 ExcelHome出品 - VBA代码宝免费下载
用ChatGPT与VBA一键搞定Excel WPS表格从入门到精通 Excel VBA经典代码实践指南
查看: 819|回复: 0

[求助] VBA插入形状组合问题

[复制链接]

TA的精华主题

TA的得分主题

发表于 2019-2-21 10:56 | 显示全部楼层 |阅读模式
我写了一个宏,在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 下一条

手机版|关于我们|联系我们|ExcelHome

GMT+8, 2024-4-23 18:42 , Processed in 0.026523 second(s), 11 queries , Gzip On, MemCache On.

Powered by Discuz! X3.4

© 1999-2023 Wooffice Inc.

沪公网安备 31011702000001号 沪ICP备11019229号-2

本论坛言论纯属发表者个人意见,任何违反国家相关法律的言论,本站将协助国家相关部门追究发言者责任!     本站特聘法律顾问:李志群律师

快速回复 返回顶部 返回列表