Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.

Hi @SPALANIAPPANTN47S 

Executing a controldefinition will give the same result as clicking the button in the UI manually. Therefore, the check in command will be run on the document that is active at the time when you execute the command.

I think you'll get your desired result if you make sure to activate each drawing document before executing the command (oDoc.Activate). Otherwise it's like a lottery which document will be checked in (The one that gets activated when the previously active document is closed)

 

Try this :slightly_smiling_face:

 

Sub CheckInMultipleOpenDrawings()

Dim oDoc As Inventor.Document

For Each oDoc In ThisApplication.Documents.VisibleDocuments

If oDoc.DocumentType <> kDrawingDocumentObject Then
GoTo NextDoc

ElseIf oDoc.DocumentType = kDrawingDocumentObject Then
oDoc.Activate 'Activate the drawing
oDoc.Save

Set ControlDefinition = ThisApplication.CommandManager.ControlDefinitions.Item("VaultCheckinTop")
ControlDefinition.Execute2 (True)

oDoc.Close
End If

NextDoc:
Next

MsgBox "Checked-in the drawings"
End Sub