VBA document type

Top  Previous  Next

There is .Type and .DocumentType, you need to use the latter:

 

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

 

 

Text, images and diagrams © 2021 Owen F. Ransen. All rights reserved. (But copy the source code as much as you want!)