Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 38
Default Reading image size?

I have a number of images on a server drive, and I can easily put the path
and name of the image into a variable, i.e.

EngineMap = "S:\EmgineMaps\EngineMap 11.BMP"

The engine maps could also be in any image format, i.e.

EngineMap = "S:\EmgineMaps\EngineMap 123a.JPG"
EngineMap = "S:\EmgineMaps\EngineMap 42ed.TIFF"
EngineMap = "S:\EmgineMaps\EngineMap w3a.GIF"

But they are all in various pixel size, and I need to know the pixel size of
the images....

How can I read the pixel size of an image via Excel VBA?


Thanks in advance...

CE


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 91
Default Reading image size?

Dear CE,I have tried to give a outline.You can modify it according to
need.

This code will prompt for a folder (Containing pictures).Select a
folder only.Then it will show you the Dimension of the pic.

Sub sd()

Dim sh As New Shell, fol As Shell32.Folder3
Dim FolPath As String, i As Long, PicNum As Long

With Application.FileDialog(msoFileDialogFolderPicker)
.AllowMultiSelect = True
.ButtonName = "Choose Folder"
.InitialView = msoFileDialogViewList

If .Show Then
Set fol = sh.Namespace(.SelectedItems(1))

PicNum = fol.Items.Count

For i = 1 To PicNum
MsgBox fol.GetDetailsOf(fol.Items.Item(i), 26)
Next i

End If

End With


End Sub
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 279
Default Reading image size?

In message
s.com of Sat, 16 Apr 2011 06:12:46 in microsoft.public.excel.programmin
g, Javed writes
Dear CE,I have tried to give a outline.You can modify it according to
need.

This code will prompt for a folder (Containing pictures).Select a
folder only.Then it will show you the Dimension of the pic.

Sub sd()

Dim sh As New Shell, fol As Shell32.Folder3


[snip]

I run Microsoft Office Excel 2003(11.8332.8333) SP3.
My System is Windows Vista Business Service Pack 2.

I was not particularly surprised that compiling the code supplied
resulted in the highlighting of "sh As New Shell" and a "Compile error:
User-defined type not defined" MsgBox.

The help on this error says "... The type is a valid type, but the
object library or type library in which it is defined isn't registered
in Visual Basic.
Display the References dialog box, and then select the appropriate
object library or type library. ..."

The References dialog box can be selected in the VBE from
Tools\References..." when code is not running.
I successfully guessed a relevant reference was "Microsoft Shell
Controls and Automation".

The list of loaded references is a characteristic of the Excel
installation. A change made, while running code in one file, is carried
through to all files.

Can somebody please point me to a logical process for selecting a
reference from the several hundred which seem to be available?

(There is an appropriate probe in 3-7.VBS in "Windows Scripting
Secrets". That depends on a "typelib.decoder" object which is private to
the book. Astoundingly, I still have both book and CD. ;)

Is there anything one can put in code to cause reference satisfaction?
e.g. something like 'needs "Microsoft Shell Controls and Automation"'.

References provide early binding. However, it seem to impose conditions
on any machine running code using it. I hope that, as well as checking
name usage at compile time, early bound code runs faster than late.

I suppose I shall have to start using early binding to see if I like it.

Javed, thanks for challenging me!
--
Walter Briscoe
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
reading a string in a png image file [email protected] Excel Programming 2 March 18th 09 09:19 PM
Ribbon Image Size Josh Sale Excel Programming 2 January 9th 08 03:57 PM
Size of the background image? bkoren Excel Discussion (Misc queries) 0 January 9th 07 06:55 PM
Trying to enlarge tab size on worksheet for easier reading ricknstl Excel Discussion (Misc queries) 4 May 8th 05 03:41 PM
Open image from web in window same size as image? Milos Setek Excel Programming 0 February 5th 04 03:33 AM


All times are GMT +1. The time now is 11:07 AM.

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"