Public Function CheckoutEntity(Entity As Object, comment$, _ ByRef CanContinue As Boolean) As IVersionControl ' Check an object out for editing ' This example demonstrates the behavior when getting ' an IVersionControl reference in a project without ' version control enabled. For production code, you ' may wish to check once if version control is enabled ' and not attempt checkouts if it is not. ' See the example,"Check if version control is enabled" '-------------------------------------------------------- ' If the project has version control enabled, this routine ' checks out the entity and returns the version ' control object. ' The CanContinue argument is set to true if the Entity ' is successfully checked out or if the project does not ' have version control enabled. ' If the project has version control enabled and the checkout ' throws an exception, CanContinue is set to false. '-------------------------------------------------------- On Error GoTo checkout_err CanContinue = True Dim oVerControl As IVersionControl Dim oVE As IVersionedEntity Set oVE = Entity Set oVerControl = oVE.VC ' If the connected project does not have version control ' enabled, oVE.Vc returns null. If oVerControl Is Nothing Then Set CheckoutEntity = Nothing Exit Function End If ' Return the IVersionControl reference for use ' when checking in. Set CheckoutEntity = oVerControl ' Checkout the entity oVerControl.CheckOut comment Exit Function checkout_err: CanContinue = False End Function