2

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?

Erik A
  • 31,639
  • 12
  • 42
  • 67
CodeCamper
  • 6,609
  • 6
  • 44
  • 94

1 Answers1

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