You might want to have a look at this page: "Accessing iProperties". Apart from that I would do this:
Sub Main()
Document = ThisDoc.Document
' Set propertie
PartNumber = DateTime.Now().ToString()
Description = "www.hjalte.nl"
' Get properties
MsgBox(PartType)
MsgBox(Description)
MsgBox(PartNumber)
MsgBox(Material)
End Sub
Public Property PartType() As String
Get
Return GetProperty("Design Tracking Properties", "Document SubType Name")
End Get
Set(ByVal value As String)
SetProperty("Design Tracking Properties", "Document SubType Name", value)
End Set
End Property
Public Property PartNumber() As String
Get
Return GetProperty("Design Tracking Properties", "Part Number")
End Get
Set(ByVal value As String)
SetProperty("Design Tracking Properties", "Part Number", value)
End Set
End Property
Public Property Description() As String
Get
Return GetProperty("Design Tracking Properties", "Description")
End Get
Set(ByVal value As String)
SetProperty("Design Tracking Properties", "Description", value)
End Set
End Property
Public Property Material() As String
Get
Return GetProperty("Design Tracking Properties", "Material")
End Get
Set(ByVal value As String)
SetProperty("Design Tracking Properties", "Material", value)
End Set
End Property
Public Property Document As Document
Public Function GetProperty(setName As String, name As String) As String
Return Document.PropertySets.Item(setName).Item(name).Value
End Function
Public Sub SetProperty(setName As String, name As String, value As String)
Dim propertySet = Document.PropertySets.Item(setName)
Try
propertySet.Item(name).Value = value
Catch ex As Exception
propertySet.Add(value, name)
End Try
End Sub
Jelte de Jong
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

Blog: hjalte.nl - github.com