Checking in with the API...

Everything works great, except the check in.  It checks in, but the reverts back to the old file.  I know this because if I rem-out the CheckIn sub, the file dates are correct.

This is driving me crazy!!!  I've tried IEdmFile5 and IEdmFolder5 as well, no difference.

Thanks for any help you can provide.  

I have this blurb of code:

If IsToolbox(AF(c)) = False Then
    ' Open Model in Solidworks
    SWAPP = CreateObject("Sldworks.Application")
    SWAPP.Visible = True

   

    ' Checkout Model
    CheckOut(AF(c))

    ' Open and update Model
    If System.IO.Path.GetExtension(AF(c)).ToUpper = ".SLDASM" Then
        swModel = SWAPP.OpenDoc6(AF(c), swDocumentTypes_e.swDocASSEMBLY, 1, "", fileerror, filewarning)

    ElseIf System.IO.Path.GetExtension(AF(c)).ToUpper = ".SLDPRT" Then
        swModel = SWAPP.OpenDoc6(AF(c), swDocumentTypes_e.swDocPART, 1, "", fileerror, filewarning)

    End If

    swModel.ShowNamedView2("*Isometric", 7)
    swModel.ViewZoomtofit2()

    status = swModel.ForceRebuild3(False)

    If System.IO.Path.GetExtension(AF(c)).ToUpper = ".SLDASM" Then
        System.Threading.Thread.Sleep(10000) ' Manual Pause

    ElseIf System.IO.Path.GetExtension(AF(c)).ToUpper = ".SLDPRT" Then
        System.Threading.Thread.Sleep(3000) ' Manual Pause

    End If

    status = swModel.Save3(swSaveAsOptions_e.swSaveAsOptions_Silent, fileerror, filewarning)

    SWAPP.CloseDoc(swModel.GetTitle)

    ' Checkin Model
    CheckIn(AF(c))

End If

Private Sub CheckOut(fPath As String) ' fPath = C:\Sackett-Waconia\Migration Workgroup\Workgroup\TOWER\Tower 150 Ton\17-2651 Prinsburg, MN\E7080099.sldasm, or whatever is called
    Dim eFile12 As IEdmFile12 = VAULT.GetFileFromPath(fPath)
    Dim eFolder9 As IEdmFolder9
    Dim ePos5 As IEdmPos5 = eFile12.GetFirstFolderPosition
    eFolder9 = eFile12.GetNextFolder(ePos5)

    eFile12.GetFileCopy(0, 0, eFolder9.ID, EdmGetFlag.EdmGet_Simple)

    If eFile12.IsLocked = False Then
        eFile12.LockFile(eFolder9.ID, Me.Handle.ToInt32())

    End If

End Sub

Private Sub CheckIn(fPath As String) ' fPath = C:\Sackett-Waconia\Migration Workgroup\Workgroup\TOWER\Tower 150 Ton\17-2651 Prinsburg, MN\E7080099.sldasm, or whatever is called
    Dim eFile12 As IEdmFile12 = VAULT.GetFileFromPath(fPath)
    Dim eFolder9 As IEdmFolder9
    Dim ePos5 As IEdmPos5 = eFile12.GetFirstFolderPosition
    eFolder9 = eFile12.GetNextFolder(ePos5)

    eFile12.GetFileCopy(0, 0, eFolder9.ID, EdmGetFlag.EdmGet_Simple)

    If eFile12.IsLocked = True Then
        eFile12.UnlockFile(eFolder9.ID, Me.Handle.ToInt32())

   

    End If

End Sub

SolidworksApi/macros