The Object Data Type Set : Object Variable Set « Data Type « VBA / Excel / Access / Word






The Object Data Type Set

 
Sub obj()
    Dim myObject As Object
    Set myObject = range("A1:A15")
    myObject.Font.Bold = True
    Dim myRange As Excel.range
    Set myRange = range("A1:A15")
    myRange.Font.Bold = True
End Sub

 








Related examples in the same category

1.Object Data Types
2.Object Variables
3.reference can be assigned to an object variable so that you can easily refer to the new object in later code
4.The difference between object variables and regular variables
5.VBA has the ability to interact with Access to help create and edit objects
6.Object variable
7.With...End With
8.VBA knows that anything starting with a period is a property or a method of the object following the With
9.eliminate the object variable when using With statement
10.Compromise with a combination of object variables and With...End With:
11.Identifying the type of a selected object: uses the TypeName function, which returns the type of the selected object (as a string):