Getting folder paths
Bob
sRoot is a string in the module code containing the startPath
startPath is also a string.
Function LoopFolders(startPath As String, _
Optional filetype As String = "RES File", _
Optional subfolders As Boolean = True)
' Create named Ranges, for the appropriate columns in Row 8 of Worksheet
iPathCol = Range("firstPath").Column
iFileCol = Range("firstFile").Column
iLinkCol = Range("firstLink").Column
iFile = Range("firstpath").Row
sRoot = startPath
'--
root is a named cell in the worksheet
path is a named cell in the worksheet
I think FindBack must find the first \ after the root, because there are
several backslashes in the path after the root.
I notice when I miss the \ after the root it adds it to the start of the
path cells. When I add the \ to the root it dissapears from the cells.
"Bob Phillips" wrote in message
...
Presumably FindBack works from the end to find a \?
What is sRoot?
--
HTH
Bob Phillips
(there's no email, no snail mail, but somewhere should be gmail in my addy)
"dd" <dd.dd wrote in message ...
All,
I have the following line of code which gets the full path (iPath) of a
file
(iFile) from a Root directory (sRoot)
Cells(iFile, iPathCol).Value = Mid(oFile.Path, Len(sRoot) + 1,
FindBack(oFile.Path, "\") + 1 - (Len(sRoot) + 1))
I want to split it, so that the first folder in the path is displayed
under
iPathCol1
and the remainder of the path is displayed in iPathCol2.
I don't understand the part after the equals sign!
Can provide a solution for me.
Thanks in advance.
DDawson
|