Seth Ruhan

PDM  - Rename Error

Discussion created by Seth Ruhan on Oct 16, 2019
Latest reply on Oct 22, 2019 by Artem Taturevych

Hey All,


I was hoping if anyone knew the reason behind my error, We use PDM to convert files to PDF & DXF, under a certain senario the existing DXF file in PDM needs to be renamed prior to the conversion.


I added an additional part to the conversion script, however when using the PDM API IEDMFile5:Rename or IEDMFile6: RenameEX I get the error that this method is not available. 


When creating a macro in Solidworks I am also able to replicate it. I know this method is very much available so unsure why I would receive this sort of error.


I have attached the VBA macro for Solidworks, which I've been using to try and debug


Function PDM_RenameFile(path As String, newPath As String) As Boolean
Set vault = CreateObject("ConisioLib.EdmVault")
vault.LoginAuto "IAC Drawings", 0

Dim File As Object
'Get the interface of the file (and its parent folder)
Dim Folder As Object
Set File = vault.GetFileFromPath(path, Folder)
If Not (File Is Nothing) Then

bb = File.Name
File.RenameEx 0, newPath, 0 '<------- This causes the error
PDM_RenameFile = True
End If

End Function