Hi Nico
you'll find this function useful :
'create a subfolder under root corresponding to p project 'root must have a trailing backslash like "C:\Documents and Settings \All Users\Documents\" Public Function CreateLocalPath(ByVal p As PDMWProject, root As String) As folder Dim path As String While Not p Is Nothing path = p.name + "\" + path Set p = p.parent Wend 'Set CreateLocalPath = fs.CreateFolder(root + path)' does not work because parent folders must exist so... '... let's build the whole structure: Dim stack As Variant: stack = Split(path, "\") path = "" Dim i As Integer For i = LBound(stack) To UBound(stack) path = path + stack(i) + "\" If Not fs.FolderExists(root + path) Then Set CreateLocalPath = fs.CreateFolder(root + path) Next i End Function
Your main code should look like this :
Option Explicit
Public connection As PDMWConnection Public fs As New Scripting.FileSystemObject
Sub main() Set connection = New PDMWorks.PDMWConnection Call connection.Login("pdmwadmin", "pdmwadmin", "localhost") ' your login Call connection.Refresh Dim projects As PDMWorks.PDMWProjects Set projects = connection.projects Dim prj As PDMWorks.PDMWProject For Each prj In projects
Call CreateLocalPath(prj, "C:\Temp\") Next prj