Hi @Gwennberg. The quickest and simplest way to check what type of model document is being represented by a drawing (assuming there is only one model), is to use something like this iLogic code:
oDrawingDoc = ThisDrawing.Document
oModel = ThisDrawing.ModelDocument
If oModel.DocumentType = DocumentTypeEnum.kAssemblyDocumentObject Then
Exit Sub
End If
'the rest of your code here
Those lines will only work in iLogic, not in VBA. There are also other ways to obtain referenced model documents from a drawing document, then check their type too, if needed.
If this solved your problem, or answered your question, please click ACCEPT SOLUTION.
Or, if this helped you, please click (LIKE or KUDOS) 👍.
If you want and have time, I would appreciate your Vote(s) for My IDEAS :bulb: or you can Explore My CONTRIBUTIONS
Wesley Crihfield

(Not an Autodesk Employee)