ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Arranging graphical objects on sheet (https://www.excelbanter.com/excel-programming/320633-arranging-graphical-objects-sheet.html)

quartz[_2_]

Arranging graphical objects on sheet
 
I have a program that copies several images and pastes them sequentially into
a single Excel sheet.

Does anyone have a function that can position each successive image
immediately below, but not overlapping the previously copied image? If you
could supply example code it would be most appreciated.



Tom Ogilvy

Arranging graphical objects on sheet
 
assign the top attribute of the new image to the sum of the top and height
attributes of the previous image.

--
Regards,
Tom Ogivly

"quartz" wrote in message
...
I have a program that copies several images and pastes them sequentially

into
a single Excel sheet.

Does anyone have a function that can position each successive image
immediately below, but not overlapping the previously copied image? If you
could supply example code it would be most appreciated.





Sharad Naik

Arranging graphical objects on sheet
 
Example copying pix from Sheet2 to Sheet1:

Dim shp As Shape, shpSh1 As Shape
Dim i
Sheet1.Select
Sheet1.Range("A1").Select
For Each shp In Sheet2.Shapes
shp.CopyPicture
Sheet1.Paste
i = Sheet1.Shapes.Count
Set shpSh1 = Sheet1.Shapes(i)
If i 1 Then
shpSh1.Left = Sheet1.Shapes(i - 1).Left
shpSh1.Top = Sheet1.Shapes(i - 1).Top _
+ Sheet1.Shapes(i - 1).Height
'If you want to match th height and width too
' then keep below 2 lines, else delete them
shpSh1.Height = Sheet1.Shapes(i - 1).Height
shpSh1Width= Sheet1.Shapes(i - 1).Width
End If
Next

Sharad

"quartz" wrote in message
...
I have a program that copies several images and pastes them sequentially
into
a single Excel sheet.

Does anyone have a function that can position each successive image
immediately below, but not overlapping the previously copied image? If you
could supply example code it would be most appreciated.






All times are GMT +1. The time now is 12:24 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com