Hey all,
Hope you can help me with the below challenge I face:
I've got several folders with a lot of subfolders each, containing images (large majority is JPG, but there might be a few JPEGs, PNGs... ). Several users upload new images there all the time. So I am trying to get VBA to help me get overview on a regular basis of the dimensions & DPI for each image in a specific folder and all it's subfolders.
I've managed to make the below code to work quite satisfactory, but the issue is I can only get it to work in the folder I specify in the code.
Ideally I'd like when running the macro to get a prompt to select a folder for it to run into, and include all potential subfolders of the selected folder.
Please help?
I run W11, Microsoft 365 Apps for business. I'm really not that experienced with VBA, the below is a patched-together solution I've managed to make work from other posts. The currently given folder in the macro is just for tests
The output it gives me (and is quite satisfactory) is :
Column A - image name
Column B - image dimensions
Column C - Horizontal resolution
Column D - Vertical resolution
Hope you can help me with the below challenge I face:
I've got several folders with a lot of subfolders each, containing images (large majority is JPG, but there might be a few JPEGs, PNGs... ). Several users upload new images there all the time. So I am trying to get VBA to help me get overview on a regular basis of the dimensions & DPI for each image in a specific folder and all it's subfolders.
I've managed to make the below code to work quite satisfactory, but the issue is I can only get it to work in the folder I specify in the code.
Ideally I'd like when running the macro to get a prompt to select a folder for it to run into, and include all potential subfolders of the selected folder.
Please help?
I run W11, Microsoft 365 Apps for business. I'm really not that experienced with VBA, the below is a patched-together solution I've managed to make work from other posts. The currently given folder in the macro is just for tests
The output it gives me (and is quite satisfactory) is :
Column A - image name
Column B - image dimensions
Column C - Horizontal resolution
Column D - Vertical resolution
VBA Code:
Sub Get_Dims_DPI()
Dim sFile As Object
'Create Shell Object & NameSpace
Set oShell = CreateObject("Shell.Application")
Set oDir = oShell.Namespace("C:\test_images")
ActiveSheet.Cells.ClearContents
Cells(1, 1).Value = oDir.GetDetailsOf(oDir, 0)
Cells(1, 2).Value = oDir.GetDetailsOf(oDir, 31)
Cells(1, 3).Value = oDir.GetDetailsOf(oDir, 175)
Cells(1, 4).Value = oDir.GetDetailsOf(oDir, 177)
'Loop thru each File/Folder inside Root Directory
i = 2
For Each sFile In oDir.Items
Cells(i, 1).Value = oDir.GetDetailsOf(sFile, 0)
Cells(i, 2).Value = oDir.GetDetailsOf(sFile, 31)
Cells(i, 3).Value = oDir.GetDetailsOf(sFile, 175)
Cells(i, 4).Value = oDir.GetDetailsOf(sFile, 177)
i = i + 1
Next
MsgBox "Done"
End Sub