Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 55
Default objFolder.ParseName Method Not Found

I am attempting to retrieve the dimensions of an image before I insert the
image into a spreadsheet as a thumbnail so that I can scale the image
accurately.

Dim objShell As New Shell
Dim objFolder As Folder
Dim objFile As ShellFolderItem

Set objFolder = objShell.NameSpace(<path to file)
Set objFile = objFolder.ParseName(<file name)

MsgBox objFile.ExtendedProperty("Dimensions")

The above code does not seem to be working because the method "ParseName" is
not found. I have enabled the reference to "Microsoft Shell Controls and
Automation" but still no go.

Does anyone know how to enable ParseName, or have a better way of retrieving
image dimensions?

Thank you.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 37
Default objFolder.ParseName Method Not Found

This is one approach. Note that the dimensions will be returned as width by
height in pixels with " x " as separator.

'--------------------------------------------------

Private Function PictureDimensions(filePath As String) As String

Set FSO = CreateObject("Scripting.FileSystemObject")
Set objShell = CreateObject("Shell.Application")

If Not FSO.FileExists(filePath) Then
PictureDimensions = ""
End If

strParent = FSO.GetParentFolderName(filePath)
strArgFileName = FSO.GetFileName(filePath)
Set objFolder = objShell.Namespace(strParent)

For Each strFileName In objFolder.Items
If objFolder.GetDetailsOf(strFileName, 0) = strArgFileName Then
PictureDimensions = objFolder.GetDetailsOf(strFileName, 26)
End If
Next

Set FSO = Nothing
Set objShell = Nothing

End Function


'--------------------------------------------------

Steve Yandl




"Lazzaroni" wrote in message
...
I am attempting to retrieve the dimensions of an image before I insert the
image into a spreadsheet as a thumbnail so that I can scale the image
accurately.

Dim objShell As New Shell
Dim objFolder As Folder
Dim objFile As ShellFolderItem

Set objFolder = objShell.NameSpace(<path to file)
Set objFile = objFolder.ParseName(<file name)

MsgBox objFile.ExtendedProperty("Dimensions")

The above code does not seem to be working because the method "ParseName"
is
not found. I have enabled the reference to "Microsoft Shell Controls and
Automation" but still no go.

Does anyone know how to enable ParseName, or have a better way of
retrieving
image dimensions?

Thank you.



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
method or data member not found Curt Excel Programming 0 April 30th 08 05:16 PM
method or data member not found Curt Excel Programming 0 April 29th 08 04:39 PM
parsename gh Excel Programming 6 August 23rd 06 04:13 PM
[XL2000] ObjFolder.Self.Path - 438 error Mike Iacovou Excel Programming 2 May 18th 06 05:46 AM
Method or data member not found No Name Excel Programming 1 September 19th 04 02:42 PM


All times are GMT +1. The time now is 01:16 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"