1
我想從c#使用VBA可擴展互操作找到msform上的所有控件。找到msform上的所有控件從c#
我可以用查找所有形式:
using System;
using Microsoft.Office.Interop.Excel
using Microsoft.Vbe.Interop;
using Microsoft.Vbe.Interop.Forms;
.....
foreach (Microsoft.Vbe.Interop.VBComponent mycom in wb.VBProject.VBComponents)
{
if (mycom.Type == Editor.vbext_ComponentType.vbext_ct_MSForm)
.....
,但我不能找到窗體上的控件。
我認爲它應該是這個樣子:
....
foreach (Microsoft.Vbe.Interop.Forms.Control ctrl in Microsoft.Vbe.Interop.VBComponent.Designer.Controls)
....
但Controls集合無法識別。
任何想法?
這個線程提供的問題,我現在面臨的更多信息:
我覺得這個問題是到傳承與互操作。 '通用'Designer對象應該從窗體互操作中繼承控件對象。看來vb.net會自動執行此轉換...但我不知道如何! – jedd 2009-08-04 10:44:22