Hi,
I posted this one in the general-section, but this section is better..
With Excel 2003 I'm trying to retreive the size of an image in an external folder, but instead of the size I keep getting the description "Dimension" instead of the size.
With the images in C:\images and an image test.jpg the code is:
Sub ATest()
Dim sPathAfbeeldingen As String
Dim sPath As String
Dim cellComment As String
Dim sFilename As String
Dim lngWidth As Long
Dim lngHeight As Long
Dim objFSO As New FileSystemObject
Dim objShell As Object
Dim objFolder As Object
Dim strDimensions() As String
ReDim strDimensions(3)
sPathAfbeeldingen = "C:\images\"
sFilename = "test.jpg"
strPath = sPathAfbeeldingen & sFilename
Set objShell = CreateObject("Shell.Application")
Set objFolder = objShell.Namespace(objFSO.GetParentFolderName(strPath))
strDimensions(0) = objFolder.GetDetailsOf(sFilename, 26)
strDimensionss = Split(strDimensions(0), "x")
lngWidth = CLng(Mid(Trim(strDimensions(0)), 2))
lngHeight = CLng(Mid(Trim(strDimensions(1)), 1, Len(Trim(strDimensions(1))) - 1))
MsgBox strPath & ": " & lngWidth & "," & lngHeight
Debug.Print lngWidth
Debug.Print lngHeight
Set objFSO = Nothing
Set objFolder = Nothing
Set objShell = Nothing
End Sub
strDimensions(0) = objFolder.GetDetailsOf(sFilename, 26) reads "Dimensions" instead of "220 x 151" (or something like that, I don't know what it looks like because I've never seen it yet).
Every other objFolder.GetDetailsOf(sFilename, xx) returns the description rather than the actual values.
How do i read the dimension? Or the other values?
Now I did find a working solution elsewhere in this forum:
http://www.excelforum.com/excel-prog...-not-load.html
Anyway, I do not understand why the first routine doesn't work. Anyone knows the answer?
Thanx, greetings, CJ.
Bookmarks