I am trying to incorporate some code to an excel VBA macro that will do a PDM search for a variable that's already defined and then get the latest version of that file.
Any help is greatly appreciated. Thanks Eric
2016 SOLIDWORKS API Help - GetFileCopy Method (IEdmEnumeratorVersion5)
This should get you pointed in the right direction:
Thanks for the info. Does anyone have an example of these operations in VBA?
I am also trying to figure out a way to search PDM inside of Excel using VBA. Have you found a solution?
I was able to write the code to search and find the file based on the variable, but I never found code to "get latest version"
Hello Eric, i'm interested to know your code "to search and find the file based on the variable"
Dim eVault As IEdmVault5
Dim eSearch As IEdmSearch5
Dim eResult As IEdmSearchResult5
Dim eFolder As IEdmFolder5
Dim eName As IEdmObject5
Dim eCardaccess As IEdmEnumeratorVariable5
Dim vaultname As String
Dim FileName As String
vaultname = ("your vault name here") 'vault name
Set eVault = New EdmVault5
If Not eVault.IsLoggedIn Then 'log into vault
Call eVault.LoginAuto(vaultname, 0)
Set eSearch = eVault.CreateSearch 'set search
eSearch.FindFiles = True
eSearch.FindUnlockedFiles = True
eSearch.FindLockedFiles = True
eSearch.Recursive = True
FileName = "value you want to search"
eSearch.AddVariable "Part Number", FileName 'variable searching for and value
Set eResult = eSearch.GetFirstResult 'results of search
Retrieving data ...