Enterprise PDM Files and Variables
‘reconnect to the file's EnumeratorVariable
‘after check out
eVar = eFile.GetEnumeratorVariable
‘edit the file here
Try
eVar.SetVar("Description", "@", "NEW
DESCRIPTION")
‘close the file and save (flush) any updates
eVar .CloseFile (True)
Catch ex As Exception
MsgBox (ex.Message & vbLf & eFile.Name)
Exit Sub
End Try
"try to check in the file
Try
eFile.UnlockFile(0, "API check in")
Catch ex As Exception
MsgBox (ex.Message & vbLf & eFile.Name)
Exit Sub
End Try
The first step before attempting to edit the card variable is to
reconnect to the IEdmEnumeratorVariable8 interface. We first
connected to this interface while the file was checked in. Though
itis not documented, if you do not reconnect to the interface after
checking the file out, you will get errors about the file not being
checked out by you. The process of reconnecting to the interface
is identical to connecting in the first place.
lEdmEnumeratorVariable5.SetVar
The SetVar method is straight forward. You must pass the card
variable name, the configuration name and the desired value. Each
is a string. If you pass an invalid card variable name in the first
argument, the method returns an error. The Try block will catch
the error and display the following message in a MsgBox.
371