How to adress autoshapes that is grouped

  • Thread starter Thread starter Frank Krogh
  • Start date Start date
F

Frank Krogh

An autoshape (Shape1) is selected with the VBA statement:
ActiveSheet.Shapes("Shape1").Select

How do I select this autoshape (Shape1) if it is grouped together with
other autoshapes in one common autoshape (GroupShape1)?

Another question:
Is there a way to name a VBA macro to make it execute automatic like an "on
close" event when the workbook is closed?

Thanks for any suggestions.


Frank Krogh
 
Frank,

You need to ungroup the shapes before selecting one of the shapes
in the group. E.g.,

Dim WS As Worksheet
Set WS = ActiveSheet
WS.Shapes(1).Ungroup
WS.Shapes(1).Select

For your second question, you can use a macro named Auto_Close in
a regular module or use the Workbook_BeforeClose event procedure
in the ThisWorkbook code module.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
 

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

Back
Top