Sub CreeProprietes()
With ThisWorkbook.CustomDocumentProperties
.Add Name:="Variable1", LinkToContent:=False, Type:=msoPropertyTypeNumber, Value:=5
.Add Name:="Variable2", LinkToContent:=False, Type:=msoPropertyTypeString, Value:="toto"
.Add Name:="Variable3", LinkToContent:=False, Type:=msoPropertyTypeDate, Value:=Date
End With
End Sub
Sub ModifProprietes()
With ThisWorkbook
.CustomDocumentProperties("Variable1").Value = 6
.CustomDocumentProperties("Variable2").Value = "titi"
.CustomDocumentProperties("Variable3").Value = Date - 1
End With
End Sub
Sub LitProprietes()
Dim Var1 As Long, Var2 As String, Var3 As Date
With ThisWorkbook
Var1 = .CustomDocumentProperties("Variable1").Value
Var2 = .CustomDocumentProperties("Variable2").Value
Var3 = .CustomDocumentProperties("Variable3").Value
End With
MsgBox Var1 & " - " & Var2 & " - " & Var3
End Sub
Sub SupprProprietes()
With ThisWorkbook
.CustomDocumentProperties("Variable1").Delete
.CustomDocumentProperties("Variable2").Delete
.CustomDocumentProperties("Variable3").Delete
End With
End Sub