FindControls问题(VBA与C#) [英] FindControls question (VBA vs. C#)

查看:230
本文介绍了FindControls问题(VBA与C#)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图隐藏或重定向"回复评论"用户右键单击注释时Word显示的命令。

I am trying to either hide or redirect the "Reply to Comment" command that Word displays when a user right clicks inside a comment.

我能够在VBA中使用它:

I am able to get this to work in VBA:

Set myControls = WordApp.CommandBars.FindControls _

(类型:= msoControlButton,ID:= 854)

(Type:=msoControlButton, ID:=854)

然而, 当我在C#中尝试此操作时,找不到控制按钮:

However,  when I try this in C#, the control button is not found:

var myControl = Wd.WordApp.CommandBars.FindControl

(MsoControlType.msoControlButton,Id:854);

(MsoControlType.msoControlButton, Id: 854);

谁能告诉我我做错了什么? 

Can anyone tell me what I'm doing wrong? 

(我正在尝试查找的命令是Word中"自定义功能区"窗口中的ReplyToAnnotation。 

(The command I am trying to find is ReplyToAnnotation in the "Customize the Ribbon" window in Word. 

谢谢!

推荐答案



您在VBA代码中使用了FindControls但在C#中使用了FindControl。此外,我没有在Word 2007,2010,2013或2016中找到任何内置控件的ID是854.


这是我在c#中使用FindControls的代码。

Hi,
You used FindControls in VBA code but FindControl in C#. Besides, I didn't find any built-in control's id is 854 neither in Word 2007,2010,2013 or 2016.
Here is my code using FindControls in c#.
Word.Application app = Globals.ThisAddIn.Application;
CommandBarControls myControls;       
 myControls = app.CommandBars.FindControls(Id:3);




最好的问候,

Celeste


Best Regards,
Celeste


这篇关于FindControls问题(VBA与C#)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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