@Anonymous
Can you try this rule and see if this works?
In this code, I am assuming you have the same names for drawing and its corresponding part/assembly file and they are located in the same path.
Dim oApp As Inventor.Application = ThisApplication
Dim oDoc As Document = oApp.ActiveDocument
ThisName = System.IO.Path.GetFileNameWithoutExtension(oDoc.FullFileName)
For Each Doc In oApp.Documents
Dim oDC As Document = Doc
If oDC.DocumentType = DocumentTypeEnum.kDrawingDocumentObject And System.IO.Path.GetFileNameWithoutExtension(oDC.FullFileName) = ThisName
oDC.Activate
Else If System.IO.Path.GetFileNameWithoutExtension(oDC.FullFileName) <> ThisName
Dim str As String = (System.IO.Path.GetDirectoryName(oDoc.FullDocumentName) & "\" & ThisName & ".dwg")
oApp.Documents.Open(str, True)
End If
Next
Hope this will help you.
If this answer has solved your problem please ACCEPT SOLUTION and hit like if you found it helpful..!
Regards,
Dutt Thakar
LinkedIn