iedmFile.UnlockFile says non-current user has file checked out?
Posted: Wed Apr 26, 2023 7:52 pm
I have a VBA script which checks out a file, makes a couple changes to the references, and then checks it back in.
Or, it used to. For about a year and a half. Now the file.UnlockFile command....doesn't.
Script runs all the way through, but it gets to file.UnlockFile and throws the error:
After I terminate the script, I can go into PDM directly and check the file in without trouble. It's just when I try to do it via code using the file.UnlockFile command that it has an issue. This is in every script where I use this command, it happens every time the script is run, it happens with every user, it happens with every file of the type the script runs on (a virtual doc we use for engineering signoffs), and it happens no matter how the script is invoked (via a dispatch or via a test sub in the code).
I have the suspicion it's related to a change in our network that happened earlier this year, same time as the problem first cropped up - working on that angle with our IT guys.
But, is this familiar to anyone? Maybe I'm missing something simple that I somehow used to get away with.
(Using SW 2021 SP5, and Enterprise PDM, with the code hosted in an Excel spreadsheet - long story).
Or, it used to. For about a year and a half. Now the file.UnlockFile command....doesn't.
Script runs all the way through, but it gets to file.UnlockFile and throws the error:
Which is a lie -- the file.LockFile command twenty lines above it is what locked it in the first place. I've verified this by printing file.IsLockedByUser.Name in the Immediate window in VBA.Run-time error '-2147220976 (80040210)':
The file isn't checked out by you, which is required by the operation.
After I terminate the script, I can go into PDM directly and check the file in without trouble. It's just when I try to do it via code using the file.UnlockFile command that it has an issue. This is in every script where I use this command, it happens every time the script is run, it happens with every user, it happens with every file of the type the script runs on (a virtual doc we use for engineering signoffs), and it happens no matter how the script is invoked (via a dispatch or via a test sub in the code).
I have the suspicion it's related to a change in our network that happened earlier this year, same time as the problem first cropped up - working on that angle with our IT guys.
But, is this familiar to anyone? Maybe I'm missing something simple that I somehow used to get away with.
(Using SW 2021 SP5, and Enterprise PDM, with the code hosted in an Excel spreadsheet - long story).