Contingut

# Set Statement

Sets an object reference on a variable.

### Sintaxi:

       [Set] variable = [New] object

### Paràmetres:

variable: a variable or a property that requires an object reference.

expression: A computable combination of terms such as a formula or an object property or method.

object: Object that the variable refers to.

Res - Assigna Res a una variable per eliminar una assignació anterior.

Set keyword is optional. Nothing is the default value for objects.

### Exemple:

    Sub ExampleSet
        Dim obj As Object
        Set obj = ThisComponent
        Print obj.Title

        obj = New com.sun.star.beans.PropertyValue
        With obj
            .Name = "key" : .Value = 594.34
            Print .Name, .Value
        End With
    End Sub

Nou crea objectes UNO o objectes de classe mòdul abans d'assignar-los a una variable.

Temes relacionats

New Operator

Ens cal la vostra ajuda!