Convert group of shapes to picture

hakanfa

New Member
Joined
Mar 25, 2020
Messages
36
Office Version
  1. 365
Platform
  1. Windows
Hi,
I'm working an a project where I try to convert a group of shapes to a picture and then delete the group. Shortly how I done so far:
(the s_text, s_header etc. are programmatically generated shapes)

Dim shpGroup As Shape
Set shpGroup = sales_sheet.Shapes.Range(Array(s_text.Name, s_header.Name, lastNote.Name)).Group

shpGroup.CopyPicture
sales_sheet.Pictures.Paste
shpGroup.Delete

This works well, but now I need to capture the newly pasted image (name of object) for further process. Any ideas how to proceed?

Thankful for all possible solutions!

br
Hakan
 

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
Try this

Add another variable
VBA Code:
Dim pic As Shape
after this line
VBA Code:
sales_sheet.Pictures.Paste
add this line
VBA Code:
Set pic = sales_sheet.Shapes(sales_sheet.Shapes.Count)

pic.Name provides the name for future use
 
Upvote 0
Solution
Try this

Add another variable
VBA Code:
Dim pic As Shape
after this line
VBA Code:
sales_sheet.Pictures.Paste
add this line
VBA Code:
Set pic = sales_sheet.Shapes(sales_sheet.Shapes.Count)

pic.Name provides the name for future use
Yess! Precisely! Thank you very much for the solution!
 
Upvote 0

Forum statistics

Threads
1,223,626
Messages
6,173,415
Members
452,514
Latest member
cjkelly15

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top