Hello Everyone, I'm hoping someone can please help me out. The below macro is really close to working. I am trying to create a PDM task where I can right-click on a drawing and it will run a task to open the drawing, check it out, rebuild/save, then check it back in. This macro appears to check out the file and check it back in with "Checked in by Macro" in the comments and the version is incremented, however it doesn't appear to open the file or rebuild or save it. Any help would be greatly appreciated. Thanks everyone.
Dim swApp As SldWorks.SldWorks
Dim swModel As SldWorks.ModelDoc2
Dim pdmVault As Object
Dim strFullPath As String
Dim strFolderPath As String
Dim strFileType As String
Dim intFileType As Integer
Dim i As Integer
Dim strFileName As String
Set swApp = Application.SldWorks
strFullPath = "<Filepath>"
strFolderPath = "<Path>"
'Limit the macro to SLDDRW files
strFileType = LCase(Right(strFullPath, 6))
Select Case strFileType
intFileType = 3
'Grabs filename only
i = InStrRev(strFullPath, "\")
strFileName = Right(strFullPath, Len(strFullPath) - i)
'Create vault object
Set pdmVault = CreateObject("ConisioLib.EdmVault")
pdmVault.loginauto "[vaultName]", 0
Dim folder As Object
Set folder = pdmVault.GetFolderFromPath(strFolderPath)
Dim file As Object
Set file = pdmVault.GetFileFromPath(strFullPath, folder)
'Check out if needed
If False = file.IsLocked Then
file.LockFile folder.ID, 0
Set swModel = swApp.OpenDoc(strFullPath, intFileType)
If True = file.IsLocked Then
file.UnlockFile 0, "Checked in by Macro"