Excel2010中的“窗体控件”和“ ActiveX 控件”有什么区别?

通过使用 MicrosoftExcel2010,我注意到有两种控件可以插入到文档中: 表格管制ActiveX 控件

enter image description here

他们之间有什么区别?

256549 次浏览

谷歌充满了这方面的信息。正如 Hans Passant 所说,表单控件内置在 Excel 中,而 ActiveX控件是单独加载的。

通常你会使用 Forms控件,它们更简单。ActiveX控制允许更灵活的设计,应该使用时的工作只是不能用一个基本的 Forms控制。

Many user's computers by 违约不会信任 ActiveX, and it will be disabled; this sometimes needs to be manually added to the trust center. ActiveX is a microsoft-based technology and, as far as I'm aware, is not supported on the Mac. This is something you'll have to also consider, should you (or anyone you provide a workbook to) decide to use it on a Mac.

One major difference that is important to know is that ActiveX controls show up as objects that you can use in your code- try inserting an ActiveX control into a worksheet, bring up the VBA editor (ALT + F11) and you will be able to access the control programatically. You can't do this with form controls (macros must instead be explicitly assigned to each control), but form controls are a little easier to use. If you are just doing something simple, it doesn't matter which you use but for more advanced scripts ActiveX has better possibilities.

ActiveX 也更具可定制性。

请注意,在某些情况下,单击 Form Control 或 ActiveX Control 会为同一个宏提供两个不同的结果——这种情况不应该发生。我觉得 X 特工更可靠。

同样值得注意的是,ActiveX 控件只能在 Windows 中工作,而窗体控件可以在 Windows 和 MacOS 版本的 Excel 中工作。