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

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
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,216,074
Messages
6,128,653
Members
449,462
Latest member
Chislobog

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