+ Reply to Thread
Results 1 to 15 of 15

Picking up Image Attributes from Folder File

  1. #1
    Registered User
    Join Date
    01-26-2010
    Location
    Mount Dora, Florida
    MS-Off Ver
    Excel 2000
    Posts
    3

    Picking up Image Attributes from Folder File

    Hello -- what a great site! Already saved me hours of work. Ok, the title is a little obscure. What I want to do in VBA is to be able to read and place in a variable the image Width and Height of an image in a folder. I can (with help from here) read the filenames in folder. But is there a way in Excel to read the above attibutes?

    Thanks in advance. If you need more info about my goal, I'll supply it.

    Mike

  2. #2
    Forum Guru shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Picking up Image Attributes from Folder File

    See http://www.experts-exchange.com/Prog..._21653698.html.

    Scroll waaaaay down.
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Registered User
    Join Date
    01-26-2010
    Location
    Mount Dora, Florida
    MS-Off Ver
    Excel 2000
    Posts
    3

    Re: Picking up Image Attributes from Folder File

    Thanks shg, but I don't want to sign up with a monthly fee to get an answer. Too many subscriptions to things already. :o) It can't be that difficult. I just can't find it on the net.

    But, thanks for your reply.

    Mike

  4. #4
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: Picking up Image Attributes from Folder File

    Can you not simply scroll right to the bottom, as shg said? That always used to work...
    Remember what the dormouse said
    Feed your head

  5. #5
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: Picking up Image Attributes from Folder File

    In case you can't view it, here's a function (using remarkably similar code) that will return the dimensions (you pass it the folder and file name):
    Please Login or Register  to view this content.
    Note: You need to set a reference to the 'Microsoft Shell Controls and Automation' (via Tools-References in the VB Editor) for the code to work. I tried to rewrite it using late binding but cannot get it to run without error, even though MSDN says the three objects involved can all be late bound...

  6. #6
    Forum Guru teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,364

    Re: Picking up Image Attributes from Folder File

    shg, romperstomper, you may have access to Experts-Exchange that the OP does not have. AFAIK, this site does not disclose answers to non-members.

    Correct me if I'm wrong, but when I'm not logged in, I don't see anything useful on that link (unless you consider the six pack abs in the ad )
    Last edited by teylyn; 01-26-2010 at 07:19 AM.

  7. #7
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: Picking up Image Attributes from Folder File

    teylyn,
    It always used to be possible to view them by scrolling to the bottom of the page. It would seem that doesn't work any longer, at least as far as I can see.

  8. #8
    Forum Guru teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,364

    Re: Picking up Image Attributes from Folder File

    log out and try!

  9. #9
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: Picking up Image Attributes from Folder File

    I did, hence my comment...

  10. #10
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: Picking up Image Attributes from Folder File

    After further discussion with a knowledgeable colleague, it turns out you can late bind if you make the first argument a variant. We are still trying to figure out why!
    Please Login or Register  to view this content.

  11. #11
    Forum Guru shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Picking up Image Attributes from Folder File

    Ooops -- should have stopped back by the thread before sending you a PM, R.

    This is what I ended up with for late binding:

    Please Login or Register  to view this content.
    We are still trying to figure out why!
    I'd be interested if you sort that out.
    Last edited by shg; 01-26-2010 at 12:30 PM.

  12. #12
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: Picking up Image Attributes from Folder File

    I'll keep you posted!

  13. #13
    Registered User
    Join Date
    01-26-2010
    Location
    Mount Dora, Florida
    MS-Off Ver
    Excel 2000
    Posts
    3

    Re: Picking up Image Attributes from Folder File

    The way it worked was I scrolled to the bottom, found the indication of a reply, but to see it I had to "register" which involved a monthly fee.

    Mike

  14. #14
    Registered User
    Join Date
    06-17-2012
    Location
    Jessore, Bangladesh
    MS-Off Ver
    Excel 2010
    Posts
    1

    To: Shg | Re: Picking up Image Attributes from Folder File

    Thanks shg! the code works fine.
    I just want to know that how can I get the width and height of the image cause "width" or "height" is not working. To get the bit depth I've to write "bitdepth".
    A quick reply would be appreciated.
    Thanks again.
    -MD. Saffan Alvy.

  15. #15
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: Picking up Image Attributes from Folder File

    The code returns the dimensions.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1