首页 > 解决方案 > VBA 中的 System.Windows.Forms?

问题描述

我注意到 Excel 的 VBE、工具、参考中存在 System.Windows.Forms 的参考。

是否可以在 VBE 中显示 Windows 窗体?我知道我可以在运行时在 PowerShell 中创建 Windows 窗体,但到目前为止,我尝试使用 VBA 创建/显示 Windows 窗体的尝试都失败了。例如,

Sub Test()
    Dim oForm As New System_Windows_Forms.Form
    
    oForm.Show

End Sub

如果我正在尝试一些不可能的事情,那么参考的用途是什么?单独控制?

此外,如果 System_Windows_Forms 不可行,还有其他方法可以在 VBE 中显示非 VBA 用户窗体吗?显示常规用户窗体并仅隐藏 Excel 应用程序的“旧”方法并不是我真正想要的。

标签: excelvba

解决方案


推荐阅读