如何在MS Word中检索形状的名称? [英] How do I retrieve the name of a shape in MS Word?

查看:141
本文介绍了如何在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中有两种类型的形状-InlineShapesShapes.使用一些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:

  1. 选择形状
  2. 按Alt + F11打开VBA编辑器
  3. 在立即窗口中执行以下代码:? Selection.ShapeRange.Name
  4. 因此,您得到形状的名称.
  1. select shape
  2. press Alt+F11 to open VBA Editor
  3. in Immediate window execute this code: ? Selection.ShapeRange.Name
  4. 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中检索形状的名称?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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