I've been looking into the underlying structure of object properties and methods in VBA a bit more. I've just read that all properties and methods for each object is listed in the "Object Browser" in the developer box.
The reason why I was prompted to look at this was that I used a method that wasn't listed in the Object Browser. I used:
Sheets("Front face").Shapes("Drop Down 12").ControlFormat
This allowed me to then use .List to change the Shape. However .ControlFormat isn't a property/method listed in Object Browser.
Can anyone explain this?
It appears in mine - perhaps you're looking for "Shapes" which is a collection, as opposed to "Shape" which is the actual object?
Detail:
Shapes
is a collection of Shape
objects - therefore Shapes
has properties and methods that relate to a Collection
object. Each item in that collection is a Shape
object which has the properties and methods of a Shape
Besides what MacroMan explained, here is something you should always follow (as a habit)
Work with objects for intellisense to work correctly .
See this Example
Sub Sample()
Dim ws As Worksheet
Dim Shp As Shape
Set ws = Sheets("Front face")
Set Shp = ws.Shapes("Drop Down 12")
End Sub
Now if you do Shp.
you will get the .ControlFormat
property.
Another example
When you want to access the .Range
of a worksheet, you will not get that if you type Activesheet.
. For intellisense, again work with objects.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.