PDA

View Full Version : About excel vba objects



wpanssi
10-16-2008, 06:54 AM
I'm a vba newbie and I was wondering is it possible to see which are all the available properties or subobjects while writing code. For example, if I write activesheet I would like to see that activesheet contains rows -object and colums -object: activesheet.rows, activesheets.colums

How can I check which are all the possibilities with activesheet or some other object?

Thanks in advance!

CreganTur
10-16-2008, 07:41 AM
Welcome to the forum! Always good to see new members.

What you're asking for is called the object browser. You can access it via the VBE. Click Tools -> Object Browser.

Intellisense will also help you out with parameters when you're writing code, as long as you are using the correct syntax.

david000
10-16-2008, 11:56 PM
I personally think that it's annoying that ActiveSheet doesn't trigger
intellisense!:motz2:


Sub objSheet()
Dim wks As Worksheet 'kind of object?
Dim wks1 As Worksheet 'kind of object?
Set wks = ActiveSheet 'set the object
Set wks1 = Worksheets("Sheet1") 'set the object

Sheet1.Cells(1, 1) = "foo 1" 'Intellisense works.
wks.Cells(1, 2) = "foo 2" 'Intellisense works for the wks
ActiveSheet.Cells(1, 3) = "foo 3" 'Intellisense dosen't work for ActiveSheet without Dim/Set
Worksheets("Sheet1").Cells(1, 4) = "foo 4" 'Intellisense dosen't work without Dim/Set
wks1.Cells(1, 5) = "foo 5" 'Intellisense works for the Worksheet("Sheet1")
End Sub

wpanssi
10-17-2008, 10:58 AM
Thanks! I had a heureka experience wirh the object browser. However, I have problem with the intellisense. When I write "ActiveSheet" I don't get any list of available options. When I "write Dim a as" I get possible options as a list..

CreganTur
10-17-2008, 11:42 AM
I have problem with the intellisense. When I write "ActiveSheet" I don't get any list of available options.
As David pointed out above, ActiveSheet does not trigger intellisense....for whatever reason.:dunno