Hello forum,
I'm trying to create a custom script, that allows me to clean up some data on old data cards and old custom properties
So far I have created the following - almost working script. The problem is that PDM is to slow to check out the file in question, causing an error to occur when writing data to the data card. The error occurs at "pEnumVar.SetVar". How can I fix that?
Best
Lasse
Option Explicit
Dim swApp As SldWorks.SldWorks
Dim pdmVault As Object
Dim strFullPath As String
Dim strFolderPath As String
Dim strFileType As String
Dim intFileType As Integer
Dim Errors As Long
Dim Warnings As Long
Sub main()
Set swApp = Application.SldWorks
strFullPath = "
strFolderPath = "
strFileType = LCase(Right(strFullPath, 6))
Select Case strFileType
Case "sldprt"
intFileType = 1
Case "sldasm"
intFileType = 2
Case Else
End
End Select
Set pdmVault = CreateObject("ConisioLib.EdmVault")
pdmVault.LoginAuto "LQN-Sandbox", 0
Dim folder As Object
Set folder = pdmVault.GetFolderFromPath(strFolderPath)
Dim file As Object
Set file = pdmVault.GetFileFromPath(strFullPath, folder)
Dim pEnumVar As Object
Set pEnumVar = file.GetEnumeratorVariable
If False = file.IsLocked Then
file.LockFile folder.ID, 0
End If
pEnumVar.SetVar "RevisionNote", "Default", "Test", False
pEnumVar.Flush
If True = file.IsLocked Then
file.UnlockFile 0, "Checked in by Macro"
End If
End Sub
SolidworksApi macros