Excel and pictures....a few questions...

M

marko

Hi!

Here is the problem. I work in excel and i have to insert some
pictures(about 30-50 of them), lets say all pictures from a specific
folder. so i go to insert -- picture -- from file. thats fine. All my
pictures are the same dimension- 640x480 and when i put them in excel
some are big and some are small! why is that?

now i have a VB question. How can i select all of these pictures
through VBA. i would like VBA to select all pictures on the active
sheet, i know how to resize them.

And the last question. Is there a way with VBA to take all pictures on
a sheet and put them i rows and columns so that it looks nice, and
align them. i would like 5 pictures to be in a row and if there are 40
pictures there would be 8 rows, so that i can see them all and that
they are aligned!
sorry for my bad english! :)
Thanks in advance for any help!

Marko Svaco
 
G

Guest

Hi marko,

for selecting all images on your worksheet simply use:

ActiveSheet.Shapes.SelectAll

for your question about aligning the images in rows and cols try to use this
code:

Private Sub Sort_All_Images()
Dim intI As Integer, intTop As Integer, intLeft As Integer

With ActiveSheet

intTop = 1
intLeft = 1

For intI = 1 To .Shapes.Count

If intI / 5 <> Int(intI / 5) Then
.Shapes(intI).Top = intTop
.Shapes(intI).Left = intLeft
intLeft = intLeft + 100
Else
.Shapes(intI).Top = intTop
.Shapes(intI).Left = intLeft
intTop = intTop + 100
intLeft = 1
End If

Next intI

End With

End Sub

You can even adjust the 100 as you would like to (best would be if these
values are higher than the height and width of the images...

Did this help you?

Best wishes,
Eric
 
M

marko

YOU ARE A GENIOUS!!!!!!!!!!!
IT WORKS PERFECTLY!!!!!
THANKS A MIOLLION!!!!!!

Marko Svaco
 
G

Guest

Hi Marco,

thx for the compliments - you're welcome.
Could you pls mark the answer as the answer to your question?

Thx in advance and best wishes,
Eric
 

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