SaveAs into the PDM vault

Anyone could share the VBA methods for saving as new files into vault from SW application?

I already figured out how to get a new serial number from the vault.

1 Like

Hi Alexandre. Have you figured out how to do that? I have a problem doing so as you can see in my question here , have you got the same issues?

1 Like

See my answer to @OldHarryMTX question.

1 Like

Sorry for late reply but the replies in your post have the solution that I’m looking for. I’m trying to escape from PDM’s copytree command because you just see a spreadsheet and a lot of data.

I’m not too sure I understand the question. Can you please post some code and an MVP?

The point is to mimic the PDM’s copy tree tool but directly from Solidworks application. You select the components into the graphical area and save as them (from vault to the vault).

You can do that with IEdmFolder.AddFiles but you need to fix the references once you move the files.

1 Like

Same problem here. Idk how to get new serial number with Saveas Method filename must be given by pdm counter.

ı find some think close to results
Private Declare PtrSafe Function GetParent Lib “user32.dll” (ByVal hwnd As Integer) As Integer
Dim pdmVault As EdmVault5
Dim snNoValue As IEdmSerNoValue
Dim newEpdmNo As Long
Dim snNo As String

Set pdmVault = New EdmVault5
pdmVault.LoginAuto "XXXXXXX", 0

If pdmVault.IsLoggedIn Then
    'TODO: Implement the routine
    Err.Raise vbError, "User is not logged in to the vault"
End If

Dim snNbrs As IEdmSerNoGen7
Set snNbrs = pdmVault.CreateUtility(EdmUtility.EdmUtil_SerNoGen)

Set snNoValue = snNbrs.AllocSerNoValue("Filenames", 0, "", 0, 0, 0, 0)
snNo = snNoValue.Value
SetLastErpNo = snNo

Dim Folder As IEdmFolder9

Set Folder = pdmVault.RootFolder

Dim copyTreeOptions As EdmCopyTreeOptions
copyTreeOption s.mbsPrefix = "Copy_"
copyTreeOptions.mbsSuffix = ""
copyTreeOptions.mbIncludeDrawings = -1 '-1 = included
copyTreeOptions.mbUseLatestVersion = -1 '-1 = copy latest versions of files
Dim destFolder As String
destFolder = "C:\XXXXXX\XXXXX"

Dim aFile As IEdmFile5
Dim Path As String
Dim lHwnd As Integer
Path = "C:\XXXXXX\Hydraulic Parts\Hydraulic Unit"
Set aFile = pdmVault.GetFileFromPath(Path)
Dim bool As Boolean
bool = pdmVault.CopyTree(aFile.ID, Folder.ID, destFolder, True, True, copyTreeOptions, lHwnd)

End Sub