自动填充/下拉框,用于第一个句点之后的参数 [英] Autocomplete / drop down box for arguments past the first full stop
问题描述
例如,如果我在Excel托管的VBA中编写参数,则
If I am writing an argument in Excel-hosted VBA, for example
ActiveSheet.UsedRange.Select
编写第一部分的一半- ActiveSheet
- CTRL + SPACE 将自动完成该部分,或者我可以选择可用的选项从下拉列表中.
Halfway through writing the first part -- ActiveSheet
-- CTRL+SPACE will autocomplete that part, or I can select the available options from a dropdown list.
但是-在第一个句号停止后,Intellisense下拉框和自动补全将无法正常工作/显示任何内容.例如,我无法自动完成 UsedRange
属性.
However- the Intellisense dropdown box and autocompletion won't work /appear for anything after the first full stop. For example I can't autocomplete the UsedRange
property.
是否有可能在撰写第一部分之前就出现建议?
Is it possible to make the suggestions appear etc. past writing the first part?
推荐答案
如果在对象浏览器(按F2)中查看 ActiveSheet
,则会看到 ActiveSheet
键入为 Object
.因此,Intellisense无法显示特定于 Worksheet
的任何其他属性.输入 Object
是有意义的,因为活动工作表可能不是标准Excel工作表,例如图表表或对话框表.
If you look at ActiveSheet
in the Object Browser (press F2), you'll see that ActiveSheet
is typed as Object
. Therefore, Intellisense can't display any further properties specific to the Worksheet
. The typing of Object
makes sense, because the active sheet might be something other than a standard Excel worksheet -- e.g. a chart sheet or a dialog sheet.
许多全局属性都是强类型的,例如 ActiveWorkbook
作为 Workbook
;Intellisense会很好地显示属性和方法.
Many global properties are strongly typed, e.g. ActiveWorkbook
as Workbook
; Intellisense will present the properties and methods just fine.
如果确定在此代码中使用的 ActiveSheet
始终引用 Worksheet
,则可以将其分配给 Worksheet
变量:
If you are certain that ActiveSheet
when used in this code will always refer to a Worksheet
, you could assign it to a Worksheet
variable:
Dim wks As Worksheet
Set wks = ActiveSheet
然后,
Intellisense将为您提供强类型变量的 Worksheet
对象的适当属性和方法:
Intellisense would then give you the appropriate properties and methods of the Worksheet
object for the strongly-typed variable:
(从理论上讲,Excel对象模型可以将 ActiveSheet
键入为 Sheet
之类的东西,其中将包含 Worksheet
的所有常见成员,图表
和 DialogSheet
.我不确定为什么不这样做.)
(Theoretically, the Excel object model could have typed ActiveSheet
as something like Sheet
, which would have all the common members of Worksheet
, Chart
and DialogSheet
. I'm not sure why this wasn't done.)
这篇关于自动填充/下拉框,用于第一个句点之后的参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!