Typing 'Activesheet.' will not bring up a list of suggestions whereas other classes will. How do I bring up this autosuggestion screen in the coding screen as I am typing?
Asked
Active
Viewed 4,622 times
2
-
possible duplicate of [Make VBE helper show up when using functions/commands to other office applications](http://stackoverflow.com/questions/25434262/make-vbe-helper-show-up-when-using-functions-commands-to-other-office-applicatio) – RubberDuck Nov 19 '14 at 14:00
-
[This answer may prove to be userful](http://stackoverflow.com/a/25437898/3198973). – RubberDuck Nov 19 '14 at 14:01
-
Property ActiveSheet As Object ... therefore no intelisence. – Daniel Dušek Nov 19 '14 at 14:04
-
@dee How do I make the ActiveSheet bring up the intelligent suggestions? – CodeCamper Nov 19 '14 at 14:06
-
2Dim someSheet As Worksheet Set someSheet = ActiveSheet, then use someSheet, there you have intelisece. – Daniel Dušek Nov 19 '14 at 14:07
1 Answers
3
In Excel, typing ActiveSheet
is invoking a property of the default object, Excel.Application . If you are working in Access (based on your tags), the default object is Access.Application, which doesn't have an ActiveSheet property. Instead, Access, will see ActiveSheet
as an undimensioned variant variable. To get the Intellisense that you seek, you must:
- Have a reference to the Excel library
- Declare a variable of type Excel.Application
- Type a dot after that variable's name and you'll see the ActiveSheet in the Intellisense
or (from @dee)
Dim someSheet As Worksheet 'As Excel.Worksheet in Access
Set someSheet = ActiveSheet 'As Excel.ActiveSheet in Access
'use someSheet, there you have intellisense
If you type Option Explicit
at the top of your module, you'll get a helpful compile error when you refer to something that doesn't actually exist or is mis-spelled, instead of accidentally declaring a new variable.

pteranodon
- 2,037
- 1
- 13
- 20
-
please include Dee's comment suggestion with this answer and I will mark it as the answer. "Dim someSheet As Worksheet Set someSheet = ActiveSheet, then use someSheet, there you have intelisece." – CodeCamper Nov 20 '14 at 17:45