vba 如何在excel表中引入用户表单?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/13115546/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-11 18:17:03  来源:igfitidea点击:

How to bring the userform in the excel sheet?

excelexcel-vbavba

提问by user441978

I have developed an UserFormVBA module.

我开发了一个UserFormVBA 模块。

But i want that userform when opening the excel sheet itself? WheN I open excelthe UserFormshould should show.

但是我在打开 Excel 工作表时想要那个用户表单?当我打开擅长UserForm是应显示。

回答by brettdj

To hide the Excel Application but show a UserFrom you could use this in the ThisWorkbookmodule

要隐藏 Excel 应用程序但显示 UserFrom,您可以在ThisWorkbook模块中使用它

Private Sub Workbook_Open()
Application.WindowState = xlMinimized
UserForm1.Show vbModeless
End Sub

回答by Daniel

To open when you open the workbook in the ThisWorkbook Module:

在 ThisWorkbook 模块中打开工作簿时打开:

Private Sub Workbook_Open()
    Userform1.Show
End Sub

Replace UserForm1 with the name of the Userform, if different.

将 UserForm1 替换为用户窗体的名称(如果不同)。

To open when you enter a particular sheet in the sheet Module:

在工作表模块中输入特定工作表时打开:

Private Sub Worksheet_Activate()
    UserForm1.Show
End Sub