1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
|
Sub TestAjouterUnePropriete()
AjouterUnePropriete "ProprieteXXY", "BBBB"
Debug.Print ThisDocument.CustomDocumentProperties("ProprieteXXY").Value
End Sub
Sub AjouterUnePropriete(ByVal NomDeLaPropriete As String, ByVal ValeurPropriete As String)
Dim I As Integer
Dim ProprieteExistante As Boolean
With ThisDocument
ProprieteExistante = False
For I = 1 To .CustomDocumentProperties.Count
If .CustomDocumentProperties(I).Name = NomDeLaPropriete Then
ProprieteExistante = True
Exit For
End If
Next I
If ProprieteExistante = False Then
.CustomDocumentProperties.Add Name:=NomDeLaPropriete, Type:=4, LinkToContent:=False, Value:=ValeurPropriete
End If
End With
End Sub |
Partager