Runtime Error with shapes(application.caller)

Talha

New Member
Joined
Sep 18, 2018
Messages
5
Dear Users,

1. I have a dynamic list of organisations.
Through VBA I insert a rectangle as shapes.

Code:
Set s = Worksheets("Tabelle1").Shapes.Addshape(62, 70, 120 150, 30)

Simultaneously I assigned the created shape a macro through

Code:
s.OnAction ="Macro"

2. Later this macro should plot data for different organisations.

I defined "Macro" as a function which has
Code:
Set shapeObject = Worksheets("Tabelle2").Shapes(Application.Caller)

Strange enough it works for some shapes but for many I get an error. Runtime error '2147024809 (80070057)'. Element with the given name not found.

I am using Office 2010.

For any solutions/suggestions I would be greatly thankful.

Best Regards
Talha
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
Welcome to the forum.

Based on that code, you added the shape to one sheet but are trying to access it as though it were on another sheet.
 
Upvote 0
How long is the name of the shape for one that fails. If it's over 31 characters, Application.Caller won't work properly.
 
Upvote 0
They are not longer than 31 characters.

For example it is working for:
Aero-Dienst GmbH & Co. KG

and not working for
Advanced Aviation Logistic
 
Upvote 0
And what is Application.Caller returning when the error happens?
 
Upvote 0
Actually nothing. I can close the error window or debug the error. However debugging is not possible.
 
Upvote 0
Do you mean Application.Caller is actually empty? If so, can you put a workbook somewhere for me to have a look at?
 
Upvote 0

Forum statistics

Threads
1,223,896
Messages
6,175,265
Members
452,627
Latest member
KitkatToby

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