word vba:获取表中ActiveX控件的位置 [英] word vba: get position of an ActiveX control within a table

查看:584
本文介绍了word vba:获取表中ActiveX控件的位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想获取放置在表格中的ActiveX按钮的位置(行和列)。到目前为止,我只知道如何抓住按钮

I want to get the position (row & column) of a ActiveX button, placed in a table. So far I know only how to get a hand on the button

Selection.Fields.Item(1).OLEFormat.Object


所有ActiveX控件都列在

all ActiveX Controls are listed in

Me.Content.InlineShapes


似乎我可以通过

It seems that I can access the parent table via

selection.tables.item(1)


访问父表但我不知道如何确定该表中按钮的位置,例如c5r8

$

but I don't how to determine the position of the button within that table, e.g. c5r8


推荐答案

Hello Stefan,

Hello Stefan,

你可以使用下面的代码来获取当前按钮的位置。

You could use the code below to get the position of current button.

Private Sub CommandButton1_Click()
Dim cel As Cell                  
Set cel = Selection.Cells.Item(1)
MsgBox "RowIndex:" & cel.RowIndex & vbCrLf & _
       "ColumnIndex" & cel.ColumnIndex
End Sub

问候,

Celeste


这篇关于word vba:获取表中ActiveX控件的位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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