Reading the revision from the model iproperties using vba

Reading the revision from the model iproperties using vba

giel
Explorer Explorer
197 Views
2 Replies
Message 1 of 3

Reading the revision from the model iproperties using vba

giel
Explorer
Explorer

I want to read the revision of a model using vba script, but do not seem to get it,

 

what is wrong with the following code:

 

Dim oProps As PropertySet
Set oProps = oDoc.PropertySets.Item("Design Tracking Properties")
Dim partNumber As String
Dim partRevision As String

On Error Resume Next
partNumber = oProps.Item("Part Number").Value
partRevision = oProps.Item("Revision Number").Value
On Error GoTo 0

If partNumber = "" Then partNumber = oDoc.DisplayName
If partRevision = "" Then partRevision = "0"

 

Giel

0 Likes
Accepted solutions (1)
198 Views
2 Replies
Replies (2)
Message 2 of 3

andrewiv
Advisor
Advisor
Accepted solution

Revision number is actually part of the summary information property set.  Try this code

Dim oProps As PropertySet
Set oProps = oDoc.PropertySets.Item("Design Tracking Properties")
Dim oSumProps As PropertySet
Set oSumProps = oDoc.PropertySets.Item("Summary Information")
Dim partNumber As String
Dim partRevision As String

On Error Resume Next
partNumber = oProps.Item("Part Number").Value
partRevision = oSumProps.Item("Revision Number").Value
On Error GoTo 0

If partNumber = "" Then partNumber = oDoc.DisplayName
If partRevision = "" Then partRevision = "0"

 

Andrew In’t Veld
Designer / CAD Administrator

Message 3 of 3

giel
Explorer
Explorer

Yes now it works. Thank you

0 Likes