本文介绍了如何在MS Word中检索形状的名称?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在Excel中,我们在左上角有名称框",但是我找不到在Word中检索形状名称的方法.我该怎么办?
In Excel we have the "Name Box" in the upper-left side, but I could not find a way to retrieve the name of a shape in Word. How do I do that?
推荐答案
MS Word中有两种类型的形状-InlineShapes
和Shapes
.使用一些VBA代码检查形状对象的名称非常容易:
There are two types of shapes in MS Word- InlineShapes
and Shapes
. It's quite easy to check name of shape object with some VBA code:
- 选择形状
- 按Alt + F11打开VBA编辑器
- 在立即窗口中执行以下代码:
? Selection.ShapeRange.Name
- 因此,您得到形状的名称.
- select shape
- press Alt+F11 to open VBA Editor
- in Immediate window execute this code:
? Selection.ShapeRange.Name
- as a result you get name of the shape.
InlineShape
没有名称属性,因此在将InlineShape
升级为Shape
类型对象之前,您无法检查其名称.
InlineShape
doesn't have name property therefore you can't check it's name until you promote your InlineShape
to Shape
type object.
这篇关于如何在MS Word中检索形状的名称?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!