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
|