Excel:如何从 VBA 打开数据输入表单?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/26402422/
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-12 04:52:09  来源:igfitidea点击:

Excel: How to open the Data Entry form from VBA?

excelvbaexcel-vbadata-entry

提问by code_fodder

There is a built-in data entry form in Excel. I have added a shortcut to this and its quite good. It has a few little issues (i.e. it depends what cell you have selected as to what data it fills in the form).

Excel 中有一个内置的数据输入表单。我为此添加了一个快捷方式,它非常好。它有一些小问题(即,这取决于您选择了哪个单元格以及它在表单中填写的数据)。

So I want to wrap it up into a macro and add my own button. My little macro will select the appropriate cell. So the question is, using VBA, how do you call the build-in Data Entry form?

所以我想把它包装成一个宏并添加我自己的按钮。我的小宏会选择合适的单元格。所以问题是,使用VBA,如何调用内置的数据输入表单?

-EDIT-

-编辑-

Seems my question is not clear... so here is some more:

似乎我的问题不清楚......所以这里还有一些:

There is a built-in data entry form that you can use, see here: Built-in Data Entry Form

有一个您可以使用的内置数据输入表单,请参见此处:内置数据输入表单

I want to open this form using excel VBA, like this:

我想用excel VBA打开这个表格,像这样:

Sub OpenTheBuiltinDataEntryForm()
    ' Add code here to open the built-in data entry form...    
End Sub

回答by Rory

The line you are looking for is:

您正在寻找的线路是:

Activesheet.ShowDataForm

but note that your data table must begin within A1:B2 or be named Database or you will get an error.

但请注意,您的数据表必须以 A1:B2 开头或命名为 Database,否则您将收到错误消息。