Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8585487
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T22:04:43+00:00 2026-06-11T22:04:43+00:00

How can I retrieve the shape that was clicked to run a macro, without

  • 0

How can I retrieve the shape that was clicked to run a macro, without using Application.Caller?. Its name or the shape itself as an object.

I cant use Application.Caller because if the shape name is bigger than 30 characters, it retrieves only the first 30 characters.

Maybe there is an API that could retrieve the Sape object?

Edit:

  1. I don’t want to loop shapes in sheet. Looping throug all shapes in the workbook takes too much time.
  2. I can not rename the Shapes.

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T22:04:44+00:00Added an answer on June 11, 2026 at 10:04 pm

    Can you rename the Shape objects in your Worksheet?

    Private Sub Workbook_Open()
    Dim shp As shape
    Dim i As Integer
    
    For Each shp In ThisWorkbook.Sheets(1).Shapes
        shp.Name = "Shape" & Format(i, "0000")
        i = i + 1
    Next shp
    End Sub
    

    Alternatively, you could manually set the .OnAction property of each shape to pass the shape name to your function:

    Sub RenameShapes2()
    
        Dim shp As shape
        Dim i As Integer
    
        For Each shp In ThisWorkbook.Sheets(1).Shapes
            shp.name = "Shape" & "abcdefghijklmnopqrstuvwxyz0123456789_" & Format(i, "0000")
            shp.OnAction = "'userFunction """ & shp.name & """'"
            i = i + 1
        Next shp
    
    End Sub
    
    
    Sub userFunction(name As String)
        MsgBox name
    End Sub 
    

    This allows you to have Shape names over 30 characters in length. It’s kinda ugly though

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I developp a Java application using Windows Desktop Search from which I can retrieve
I know I can retrieve some settings.xml parameters using properties, like, for example ${settings.localRepository}
I have a situation whereby a thread can retrieve an object from the db,
Let's assume that Stackoverflow offers web services where you can retrieve all the questions
Can I retrieve a Method via reflection, somehow combine it with a target object,
I'm trying to retrieve a list of tags that share the same name as
I have an object of type X , which I can (obviously) retrieve in
I am trying to program a java application that consists of several windows using
I need to make some changes so that I only retrieve one object at
I can retrieve a Cookie value by: <?php $cookie=$_COOKIE[cookieName]; ?> Now i want to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.