geoffishere
02-01-2010, 08:00 AM
I am using the following code to see if certain named files are present in a folder.
I am now struggling to get a script which will report some of the document properties especially the last date modified.
Any help would be appreciated
Dim LRow As Integer
Dim LPath As String
Dim LExtension As String
Dim LContinue As Boolean
'Initialize variables
LContinue = True
LRow = 2
LPath = "K:\School of Community, Health Sciences and Social Care\Central school\ADMIN STAFF FOLDERS\Matthew Holden\Excel\"
LExtension = "*"
'Loop through all column A values until a blank cell is found
While LContinue
'Found a blank cell, do not continue
If Len(Range("A" & CStr(LRow)).Value) = 0 Then
LContinue = False
'Check if file exists for part number
Else
'Place "No" in column B if the file does NOT exist
If Len(Dir(LPath & Range("A" & CStr(LRow)).Value & LExtension)) = 0 Then
Range("B" & CStr(LRow)).Value = "No"
'Place "Yes" in column B if the file does exist
Else
Range("B" & CStr(LRow)).Value = "Yes"
End If
End If
LRow = LRow + 1
Wend
Many thanks
Geoff
Geoff, Please select your code and hit the vba button when posting code to format it for the forum.
I am now struggling to get a script which will report some of the document properties especially the last date modified.
Any help would be appreciated
Dim LRow As Integer
Dim LPath As String
Dim LExtension As String
Dim LContinue As Boolean
'Initialize variables
LContinue = True
LRow = 2
LPath = "K:\School of Community, Health Sciences and Social Care\Central school\ADMIN STAFF FOLDERS\Matthew Holden\Excel\"
LExtension = "*"
'Loop through all column A values until a blank cell is found
While LContinue
'Found a blank cell, do not continue
If Len(Range("A" & CStr(LRow)).Value) = 0 Then
LContinue = False
'Check if file exists for part number
Else
'Place "No" in column B if the file does NOT exist
If Len(Dir(LPath & Range("A" & CStr(LRow)).Value & LExtension)) = 0 Then
Range("B" & CStr(LRow)).Value = "No"
'Place "Yes" in column B if the file does exist
Else
Range("B" & CStr(LRow)).Value = "Yes"
End If
End If
LRow = LRow + 1
Wend
Many thanks
Geoff
Geoff, Please select your code and hit the vba button when posting code to format it for the forum.