.IAM = DocumentTypeEnum.kAssemblyDocumentObject in VBA?

.IAM = DocumentTypeEnum.kAssemblyDocumentObject in VBA?

oransen
Collaborator Collaborator
1,592 Views
2 Replies
Message 1 of 3

.IAM = DocumentTypeEnum.kAssemblyDocumentObject in VBA?

oransen
Collaborator
Collaborator

I don't normally program in VBA so maybe I've missed something obvious. This code should list all the documents and if it is a .IAM should add "IAM" to the start of the line and otherwise add "OTHER"

 

 

Public Sub ShowDocuments2()

    ' Get the Documents collection object.
    Dim invDocs As Documents
    Set invDocs = ThisApplication.Documents
    
    ' Iterate through the contents of the Documents collection.
    Dim invDocument As Document
    For Each invDocument In invDocs
        ' Display the full filename of the document in the Immediate window.
        Select Case invDocument.Type
            Case DocumentTypeEnum.kAssemblyDocumentObject
                Debug.Print "IAM " + invDocument.FullFileName
                
            Case Else
                Debug.Print "OTHER " + invDocument.FullFileName
               
        End Select
    Next

End Sub

However the list I get is always "OTHER" even when the filename extension is "IAM", for example:

 

 

OTHER C:\Users\Owen\Documents\Inventor\Test_IAM.iam
OTHER C:\Users\Owen\Documents\Inventor\DELME_T55_10T_6R_10N.IAM
OTHER C:\Users\Owen\Documents\Inventor\DELME_T55_10T_6R_10N_CctNodi.ipt
OTHER C:\Users\Owen\Documents\Inventor\Forcelle\30093895.ipt
OTHER C:\Users\Owen\Documents\Inventor\Forcelle_2_Liscio.ipt
OTHER C:\Users\Owen\Documents\Inventor\Cue_12\30091327.ipt

I would have expected the first two lines to start with "IAM" but they start with "OTHER".

 

Am I having a senior moment?

 

 

 

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

bradeneuropeArthur
Mentor
Mentor
Accepted solution
Public Sub ShowDocuments2()

    ' Get the Documents collection object.
    Dim invDocs As Documents
    Set invDocs = ThisApplication.Documents
    
    ' Iterate through the contents of the Documents collection.
    Dim invDocument As Document
    For Each invDocument In invDocs
        ' Display the full filename of the document in the Immediate window.

        
        Select Case invDocument.DocumentType
            Case DocumentTypeEnum.kAssemblyDocumentObject
Debug.Print "IAM " + invDocument.FullFileName

            Case Else
                Debug.Print "OTHER " + invDocument.FullFileName

        End Select
    Next

End Sub

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

Message 3 of 3

oransen
Collaborator
Collaborator

..doh! I told you it was a senior moment! Thanks again.