I'm trying to get an accurate count of the number of files in a given folder, however at the moment it seems to be returning with a value which is +1. I think this may be due to some hidden temp file in the folder or thumb. file .
My code currently is:
Set objFiles = fso.GetFolder(strFolderName).Files
lngFileCount = objFiles.Count
MsgBox lngFileCount 'Total number of files
Me.number_of_items = lngFileCount
Set fsoFolder = Nothing
Set fso = Nothing
There will only ever be PDF, TIFF or (TIF) files stored in these folders, is there any way of only counting files with those extensions?