检索形状的名称 [英] Retrieve the name of a shape

查看:33
本文介绍了检索形状的名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 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. 因此,您将获得形状的名称.

InlineShape 没有 name 属性,因此在将 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.

这篇关于检索形状的名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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