NAVEEN C N
New Member
Team,
I have written a macro which will find out the if the folder exists in the specified directory or not based on the keyword of the folder.
folder keyword is 20141105
directory is
\\nasmsb1\ap\ASBPRO\Alexandria\EXPORT\HISTORY\DMV_VA_Add_Hold_Request
I am able to check if the folder exists or not with bellow mentioned macro but i want modify the macro which is able to retrieve the date and time of creation of folder. if the folder is not exists, it should return blank value.
Please do the needful..
I have written a macro which will find out the if the folder exists in the specified directory or not based on the keyword of the folder.
folder keyword is 20141105
directory is
\\nasmsb1\ap\ASBPRO\Alexandria\EXPORT\HISTORY\DMV_VA_Add_Hold_Request
I am able to check if the folder exists or not with bellow mentioned macro but i want modify the macro which is able to retrieve the date and time of creation of folder. if the folder is not exists, it should return blank value.
Code:
Sub IsItThere()
Dim KeyWd As String
Dim Pathh As String, fName As String
Dim N As Long, J As Long
N = Cells(Rows.Count, "A").End(xlUp).Row
For J = 1 To N
KeyWd = Cells(J, 1).Value
Pathh = Cells(J, 2).Value
If Right(Pathh, 1) = "\" Then
Pathh = Mid(Pathh, 1, Len(Pathh) - 1)
End If
Set objShell = CreateObject("Shell.Application")
Set objFolder = objShell.Namespace((Pathh))
For Each strFileName In objFolder.Items
fName = objFolder.GetDetailsOf(strFileName, 0)
If InStr(1, fName, KeyWd) > 0 Then
Cells(J, 3).Value = "PASS"
GoTo NextRecord
End If
Next
Cells(J, 3).Value = "FAIL"
NextRecord:
Set objFolder = Nothing
Set objShell = Nothing
Next J
End Sub
Please do the needful..
Last edited by a moderator: