Hi,
we have a folder with the name of "Test", where we have some files
1. test.pdf
2. test.jpeg
3. test.excl
how can we get the path with file name
Example
D:\owork\med\fin\test.pdf
D:\owork\med\fin\test.jpeg
D:\owork\med\fin\test.excel
Hi,
we have a folder with the name of "Test", where we have some files
1. test.pdf
2. test.jpeg
3. test.excl
how can we get the path with file name
Example
D:\owork\med\fin\test.pdf
D:\owork\med\fin\test.jpeg
D:\owork\med\fin\test.excel
Bob Phillips shows how to use the CELL function on his website here:
http://www.xldynamic.com/source/xld.xlFAQ0002.html
Hope this helps.
Pete
Tried but not worked, dont know what is wrong
got the solution
got the solution
Sub FileDetails()
Dim objFSO As Object
Dim objFolder As Object
Dim objFile As Object
Dim i As Integer
'Create an instance of the FileSystemObject
Set objFSO = CreateObject("Scripting.FileSystemObject")
'Get the folder object
Set objFolder = objFSO.GetFolder("C:\Users\Me\Desktop\Temp(5)")
i = 1
'loops through each file in the directory and prints their names and path
For Each objFile In objFolder.Files
'print file name
Cells(i + 1, 5) = objFile.Name
'print file path
Cells(i + 1, 5) = objFile.Path
i = i + 1
Next objFile
End Sub
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks