I replaced
Code: Select all
file.UnlockFile 0, "Test comment"
' EdmUnlock_FailOnRegenerationNeed 16 = Fail if the file needs to be regenerated in the CAD program
' NOTE: Only files resaved in SOLIDWORKS 2009 or later can trigger this flag
' EdmUnlock_ForceUnlock 256 = Unlock the file even if it is not modified
' EdmUnlock_IgnoreCorruptFile 4 = Ignore files with file formats unrecognized by SOLIDWORKS PDM Professional; without this flag, SOLIDWORKS PDM Professional returns E_EDM_INVALID_FILE if it encounters a corrupt file or a file containing a newer format than SOLIDWORKS PDM Professional can handle
' EdmUnlock_IgnoreReferences 128 = Silently unlock parent files without their references
' EdmUnlock_IgnoreRefsNotLockedByCaller 32 = Ignore references not locked by caller
' EdmUnlock_IgnoreRefsOutsideVault 8 = Ignore references to files outside the vault
' EdmUnlock_KeepLocked 1 = Keep the file checked out after creating the new version in the archive
' EdmUnlock_OverwriteLatestVersion 64 = Do not create a new version; overwrite the last version of the file with new changes
' EdmUnlock_RemoveLocalCopy 2 = Remove the local copy of the file from the hard disk after the file has been checked in
' EdmUnlock_Simple 0 = Check in the file using default behavior
Sample code below for the check in function
Code: Select all
Private Function CheckInFile(strFileName As String) As String
On Error GoTo ErrHand
Dim file As Object
Dim oNull As Object
Set file = Vault.GetFileFromPath(strFileName, oNull)
If file Is Nothing Then
'MsgBox "File not found."
Exit Function
End If
file.UnlockFile 64, "Test comment"
CheckInFile = "Successful"
Exit Function