The following code VB.Net code will allow you to select a new base component for your derived part reference. One thing you need to be aware of is that the method only works if your target part's geometry is a basic geometric match with the original geometry. For instance, it works great with using Copy Design in Vault because Copy Design doesn't copies the base geometry for modification but does not (at least in Vault 2014) edit the derived part reference path.
Public Sub DeriveComponentReplace()
If ThisApplication.ActiveEditObject.DocumentType <> DocumentTypeEnum.kPartDocumentObject Then
Exit Sub
End If
Dim oDoc As PartDocument = ThisApplication.ActiveEditDocument
Dim oDef As PartComponentDefinition = oDoc.ComponentDefinition
Dim oSubs As Inventor.DerivedAssemblyComponents = oDef.ReferenceComponents.DerivedAssemblyComponents '.Item(1)
Dim oSubs1 As DerivedPartComponents = oDef.ReferenceComponents.DerivedPartComponents
If oSubs.Count = 0 Then
If oSubs1.Count = 0 Then
MessageBox.Show("No derived assembly components present.", "Derived Assembly Replace", MessageBoxButtons.OK, MessageBoxIcon.Information)
Exit Sub
End If
End If
Dim oRefFile As FileDescriptor
Try
oRefFile = oSubs.Item(1).ReferencedDocumentDescriptor.ReferencedFileDescriptor
Catch
oRefFile = oSubs1.Item(1).ReferencedDocumentDescriptor.ReferencedFileDescriptor
End Try
Dim AppPath As String = ShowOpenDialog(oDoc)
If AppPath = "" Then
Exit Sub
End If
Try
oRefFile.ReplaceReference(AppPath)
Catch
MessageBox.Show("The file selected is not suitable for replacement. This tool is intended for use to account for derived component update errors upon using copy design and as such, the target file must be geometrically identical to file being replaced.", "Derived Component Replace", MessageBoxButtons.OK, MessageBoxIcon.Information)
Exit Sub
End Try
oDoc.Update2()
End Sub
It will take a little bit of work to adapt to VBA but it's very doable. I just didn't have time to do it beforehand.