ds-blue-logo
Preview  |  SOLIDWORKS USER FORUM
Use your SOLIDWORKS ID or 3DEXPERIENCE ID to log in.
DWDavid Watkins08/07/2019

I am making an Excel VBA macro to update data card values, everything but checking in and out. I keep getting errors when trying to lock or unlock the files. 

 When locking a file and getting this error but the file gets checked out to me correctly. When unlocking I get the error but the fill is not checked in. SW is not open and I don't have the file "open" in PDM so I don't have any ideas what app could have it opened? I have rebooted and all that fun, any ideas?

Set File = Vault.GetFileFromPath(Result.Path, folder5)

If File.IsLocked Then
   If File.LockedByUser.Name = user.Name Then
      setvalues Variable, Value
      File.UnlockFile 0, "" 'Error

   End If
Else
   File.LockFile folder5.ID, 0, 0 'Error
   setvalues Variable, Value
   File.UnlockFile 0, ""
End If

Thanks,

David