有没有办法在 Access 和 Excel 2007 中为 VBA 获得完整的 IntelliSense?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1065814/
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
Is there a way to get full IntelliSense for VBA in Access and Excel 2007?
提问by Bryan
In VB.NET, the IntelliSense pops up as soon as you start typing which gives you a pretty full list of things you can use at that moment. The IntelliSense in VBAhowever, doesn't kick on for me until a period is put after the part you're using. For example, I go into the VBA editor in Excel 2007 and start typing the word "Range" but the IntelliSense doesn't come up until I type "Range." after which it will give me a list of things I can use at that point.
在 VB.NET 中,只要您开始输入,IntelliSense 就会弹出,它会为您提供当时可以使用的完整列表。然而,VBA中的 IntelliSense不会为我启动,直到在您使用的部分之后放置一段时间。例如,我进入 Excel 2007 中的 VBA 编辑器并开始输入单词“ Range”,但直到我输入“ Range.” ,IntelliSense 才会出现,之后它会给我一个我可以使用的东西的列表。
Is there any way to make IntelliSense come up sooner in the VBA editor, so that I'm able to see a list of things that can be used like Davg, DCount, etc?
有没有什么办法让智能感知拿出早在VBA编辑器,让我能看到,可以像使用的东西的清单Davg,DCount等等?
回答by GSerg
Just press Ctrl+ Spaceat any time in the editor.
只需在编辑器中随时按Ctrl+ Space。
回答by Robert Harvey
No, but you can type Excelfirst. Put a period after that, and you'll find out more than you ever wanted to know about Excel.
不,但你可以Excel先打字。在此之后加上句点,您会发现有关 Excel 的信息比您想了解的要多。
Same with Access. Type Accessand a period, and you will find DCountthere.
与访问相同。键入Access和一个句点,你会在DCount那里找到。
回答by PeteMz
Unfortunately in Excel some objects are declared 'As Object' and Object doesn't have any methods so Intellisense won't be able to display any. The main culprit being Excel.ActiveSheet.
不幸的是,在 Excel 中,某些对象被声明为“作为对象”,而对象没有任何方法,因此 Intellisense 将无法显示任何方法。罪魁祸首是 Excel.ActiveSheet。
If you know what the type actually is then you can declare it explicitly and assign it to the value you want. EG:
如果您知道实际类型是什么,那么您可以显式声明它并将其分配给您想要的值。例如:
Dim mySheet As Worksheet
Set mySheet = ActiveSheet 'This line would cause a type mismatch error if mySheet was declared as something other than a WorkSheet
mysheet.[All The Intellisense For a Worksheet Pops Up]
回答by mandroid
VBA is a different beast than .NET so I'm not sure how to bring up the IntelliSense quicker. I find I have the same problem you're having in 2003.
VBA 与 .NET 不同,所以我不确定如何更快地启动 IntelliSense。我发现我遇到了与您在 2003 年遇到的相同问题。
I would suggest checking out the Object Browser though. In 2003, it's View > Object Browser, or F2, in the VB Editor. I find it's a great way to explore the class libraries available. It will show you everything that you currently have referenced and once you reference more libraries, they will also show up in the Object Browser.
不过,我建议检查对象浏览器。在 2003 年,它是 VB 编辑器中的“视图”>“对象浏览器”或 F2。我发现这是探索可用类库的好方法。它将显示您当前引用的所有内容,一旦您引用更多库,它们也会显示在对象浏览器中。

