Finding picture stats with VBA?

G

GerbilGod7

I'm trying to write a loading program for pictures using VBA in Excel.
I've written some code that can preview a picture in Excel (opens the
picture and resizes it and stuff):

Set ThisPic = .Parent.Pictures.Insert(PicPath & PicName)
'shrink image until it's within a 200px box
ShrunkWidth = ThisPic.Width 'in points. divide by .75 to get
pixels
ShrunkHeight = ThisPic.Height 'in points. divide by .75 to get
pixels
Do Until ((ShrunkWidth / 0.75) < 200) And ((ShrunkHeight / 0.75) <
200)
ShrunkWidth = ShrunkWidth * 0.9
ShrunkHeight = ShrunkHeight * 0.9
Loop
ThisPic.Width = CInt(ShrunkWidth / 0.75)
ThisPic.Height = CInt(ShrunkHeight / 0.75)

Basically, the user can select a bunch of files, and each file name
gets put into a little table with a preview button next to it, which
runs the above code. The table also has fields like Image Width and
Image Height (which are nice to know when you're uploading an image).

Now, I can easily pull the width and height out of the picture AFTER
I've loaded it into Excel. My question is whether there's a way to find
the image information without actually loading the picture... I'm
writing this for an aerial imaging company and there can be lots of
large images. I'd like to give people the option to preview a picture,
but previewing all the pictures would be very cumbersome.

Thanks!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top