在Word 2010中复制形状时不使用.Select? [英] Copy shape in Word 2010 without .Select?

查看:115
本文介绍了在Word 2010中复制形状时不使用.Select?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在不借助.Select的情况下在Word 2010中复制形状?根据 Dev Center Anchor属性返回形状的锚点范围.那是前进的道路吗?但是,下面的代码返回错误.

Is it possible to copy a shape in Word 2010 without resorting to .Select? According to Dev Center the Anchor property returns the shape's anchoring range. Could that be a way forward? However, the code below returns an error.

Sub createShape()
    Set myShape = ActiveDocument.Shapes.AddShape(msoShapeRectangle, 1, 1, 1, 1)
    myShape.Anchor.Copy
End Sub

推荐答案

虽然似乎无法不选择就复制形状,但可以复制而无需选择形状(这是我想首先复制它的原因).下面的代码给了我我想要的东西:

While it does not seem to be possible to copy a shape without selecting it, it is possible to duplicate a shape without selecting it (which was my reason for wanting to copy it in the first place). The code below gives me what I was looking for:

Sub createShape()
    Set myshape = ActiveDocument.Shapes.AddShape(msoShapeRectangle, 100, 100, 100, 100)
    Set anothershape = myshape.Duplicate
End Sub

这篇关于在Word 2010中复制形状时不使用.Select?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆