I am trying to create a project folder to store various items in.
I have created a program that will generate the directory string but I cannot get the directory to appear in the right folders.
I thought if I maintained the full path, the folders would just be created where ever the structure told it go rather then as a subdirectory of the previous location.
Project FolderLevelDirectory1Correspondence2Emails2Letters1Meeting Minutes1Schedule1Sales Order1GE Proposal1Commercial2Customer PO2SOE2Change Order History3013023031RFQ1Specifications1Drawings201-PFD202-P&ID203-General Arrangements204-Electrical205-Layout
If Not (StrPtr(ProjectName) = 0) Then 'If user cancels
ChDir "..\Desktop"
Folder = Trim(SO) & " - " & Trim(ProjectName)
ParentFolder = Folder
MkDir Folder
Folder = Folder & "\" & Cells(SRow, SCol)
PL = Cells(SRow, SCol - 1)
MkDir Folder
SRow = SRow + 1
Do Until Cells(SRow, SCol) = ""
If Cells(SRow, SCol - 1) > Cells(SRow - 1, SCol - 1) Then
Folder = Folder & "\" & Cells(SRow, SCol)
ElseIf Cells(SRow, SCol - 1) = Cells(SRow - 1, SCol - 1) Then
Pos = Len(Cells(SRow - 1, SCol))
Length = Len(Folder)
Folder = Mid(Folder, 1, Length - Pos)
Folder = Folder & Cells(SRow, SCol)
Else
x = PL - Cells(SRow, SCol - 1)
Pos = Len(Folder)
Do Until x = 0
If Mid(Folder, Pos, 1) = "\" Then x = x - 1
Pos = Pos - 1
Loop
Folder = Mid(Folder, 1, Pos + 1)
Folder = Folder & Cells(SRow, SCol)
End If
MkDir Folder
PL = Cells(SRow, SCol - 1)
SRow = SRow + 1
Loop
'ActiveWorkbook.SaveAs FileName:=Trim(SO) & " - " & ProjectName, FileFormat:=xlNormal
Else
ProjectName = "TBA"
End If
End Function
I have created a program that will generate the directory string but I cannot get the directory to appear in the right folders.
I thought if I maintained the full path, the folders would just be created where ever the structure told it go rather then as a subdirectory of the previous location.
Project FolderLevelDirectory1Correspondence2Emails2Letters1Meeting Minutes1Schedule1Sales Order1GE Proposal1Commercial2Customer PO2SOE2Change Order History3013023031RFQ1Specifications1Drawings201-PFD202-P&ID203-General Arrangements204-Electrical205-Layout
If Not (StrPtr(ProjectName) = 0) Then 'If user cancels
ChDir "..\Desktop"
Folder = Trim(SO) & " - " & Trim(ProjectName)
ParentFolder = Folder
MkDir Folder
Folder = Folder & "\" & Cells(SRow, SCol)
PL = Cells(SRow, SCol - 1)
MkDir Folder
SRow = SRow + 1
Do Until Cells(SRow, SCol) = ""
If Cells(SRow, SCol - 1) > Cells(SRow - 1, SCol - 1) Then
Folder = Folder & "\" & Cells(SRow, SCol)
ElseIf Cells(SRow, SCol - 1) = Cells(SRow - 1, SCol - 1) Then
Pos = Len(Cells(SRow - 1, SCol))
Length = Len(Folder)
Folder = Mid(Folder, 1, Length - Pos)
Folder = Folder & Cells(SRow, SCol)
Else
x = PL - Cells(SRow, SCol - 1)
Pos = Len(Folder)
Do Until x = 0
If Mid(Folder, Pos, 1) = "\" Then x = x - 1
Pos = Pos - 1
Loop
Folder = Mid(Folder, 1, Pos + 1)
Folder = Folder & Cells(SRow, SCol)
End If
MkDir Folder
PL = Cells(SRow, SCol - 1)
SRow = SRow + 1
Loop
'ActiveWorkbook.SaveAs FileName:=Trim(SO) & " - " & ProjectName, FileFormat:=xlNormal
Else
ProjectName = "TBA"
End If
End Function