View Single Post
  #10   Report Post  
Posted to microsoft.public.excel.programming
Juan Pablo González Juan Pablo González is offline
external usenet poster
 
Posts: 226
Default Repost: Speed of inserting pictures and Excel memory

Not directly that I know of, but I think you can get the image properties by
loading it into a IPicture object, if I remember correctly (I think I did
something like that a while ago, can't remember for sure now)

--
Regards,

Juan Pablo González
Excel MVP

"Peter T" <peter_t@discussions wrote in message
...
Hi Juan Pablo,

I never thought to use the Reset button in Format Picture / Size, for the
purpose you describe. Good idea.

The same dialog indicates original Height & Width. Seems strange that VBA
does not expose these properties directly, or does it ?

Regards,
Peter T

"Juan Pablo González" wrote in message
...
Greg,

You are correct about the Shapes.AddPicture, it is a pain. However, it
is
simply "fixable". If you record a macro that selects a shape, and reset

it
to its default state, you'll have the required lines to resize the shape

to
its original size without distorting it.

I had to switch from the Pictures.Insert because it was failing for no
apparent reason that I could see, and so far I haven't had any other

issues
with Shapes.AddPicture, besides having to resize the picture after I

insert
it.

--
Regards,

Juan Pablo González
Excel MVP

"Greg Wilson" wrote in message
...
Juan,

Thanks a million for responding. The InitializePhotos macro that I
appended
is simpler and more efficient than forcing a complete scroll becasue it
only
adds each selected photo once and then deletes them all at once.

The simulated scrolling process makes it look like the photos at one
end
shift out of view while the majority shift over and new ones come into
view
at the opposite end. What actually happens is that I delete all of them
and
then reinsert most of the same photos back but shift them over relative

to
their former positions. I refrain from reinserting those at the end
that
appears to shift out of view and insert new ones at the opposite end

where
it
appears that new photos scroll into view. So, if the object is just to
"introduce" photos to Excel and size them (I call this Initializing),

then
this is a very inefficient process.

I failed to mention that, after adding all the photos with the
InitializePhotos macro with screen updating set to False, I have to set

it
to
True BEFORE deleting them or the macro doesn't work. In other words,

it's
as
if Excel needs to "see" all of them at the same time with the correct

size
before I delete them. However, even with screen updating set to False,

you
can still see the photos get added. So it's a nuisance. And I can't
hide
it -
It must be in view !!!

As would be expected, if I run the macro a second time, since Excel has
already seen the photos, the macro is extremely fast.

I havn't experimented with the new Shapes.AddPicture method. I use the

old
Pictures.Insert method instead; the reason being that for the latter,
width
and height dimensions are required arguments. I suspect I'm missing
something
here because, depending on the camera, pictures have different

proportions
(don't assume I have any expertise). So if you specify the dimensions

you
thereby specify the proportionality which may be wrong for the

particular
camera; and thus the photos will be distorted. Do I have this wrong ?

Any insights much appreciated.

Kind regards,
Greg



"Juan Pablo González" wrote:

I didn't look deep in the code, but I've seen in the past some
projects
that
have similar issues (being slow the first time). So, could it be
possible
to do a "fake" scroll to do that first load, and then the process
would
appear normal to the user ?

--
Regards,

Juan Pablo González
Excel MVP