VBA see if part is checked out from Vault

VBA see if part is checked out from Vault

rcolon9E4ZX
Advocate Advocate
2,244 Views
4 Replies
Message 1 of 5

VBA see if part is checked out from Vault

rcolon9E4ZX
Advocate
Advocate

Hey guys,

 

I am developing a macro to generate the value of an iproperty based on others and some additional text for each child in an assembly. It works great, except I want to know if certain parts are checked out from the Vault when looping so I know to skip them. Currently, the program still makes edits to the checked out parts, even though it is read only and grayed out in Bill of Materials. Is there a line of code that can return true/false for if a part is checked out? 

 

Many thanks in advance!

 

Rafael L. Colon

Abtex, Inc.

0 Likes
Accepted solutions (1)
2,245 Views
4 Replies
Replies (4)
Message 2 of 5

Anonymous
Not applicable

Based on past posts from actual ADSK programmers it does not look the API provides any methods to accomplish what you are requesting.

 

https://forums.autodesk.com/t5/inventor-customization/vault-access-through-inventor/m-p/5560858/high...

 

https://forums.autodesk.com/t5/inventor-customization/check-vault-status-via-vba/m-p/2795396/highlig...

 

Then again, I found this post from an ADSK programmer's blog about checking for read-only, using VB.net.

 

http://adndevblog.typepad.com/manufacturing/2012/05/checking-whether-a-inventor-document-is-read-onl...

 

Best of luck.

 

M.

0 Likes
Message 3 of 5

rcolon9E4ZX
Advocate
Advocate
Accepted solution

I found some code that returns if a file is read-only or not. This correlates to if a file is checked out by you or not. It works perfectly for what I am trying to do. When a part is checked in or checked out by another user, the local file for the part is read only. When a part is checked out by you, the file is not read-only. This can be seen when you right click on the part file -> Properties.

Read-Only.PNG

 

Here is the function that returns true or false if the file is read-only or not. No additional references are needed.

Private Function IsFileReadOnly(sFile) As Boolean
     ' Test to see if the Read-only attribute was assigned to the file.

    If GetAttr(sFile) And vbReadOnly Then
        IsFileReadOnly = True
    Else
       IsFileReadOnly = False
    End If

End Function

Hope this helps others.

 

Rafael L. Colon

Abtex Inc.

Message 4 of 5

0x3FA5
Advocate
Advocate
Glad that I found your solution, works perfectly, thank you!
0 Likes
Message 5 of 5

rcolon9E4ZX
Advocate
Advocate
Glad to hear it. Cheers.
0 Likes