How to disable shape copy paste with vba in worksheet - please check this

Akanjana

Board Regular
Joined
Mar 22, 2020
Messages
104
Office Version
  1. 2016
Platform
  1. Windows
i have few flowchart shapes in excel sheet. which i use for label designing purpose. but i don't want to allow user to copy paste selected shape object in same worksheet.

VBA Code:
Application.copyObjectsWithCells = False

Application.CutCopyMode = False


daAFw.png



The reasons for not allowing copy paste to users are as follows:
1) on shape copy paste the name of shape is not getting changed
2) with two shapes with same name, i can not target shape selection with .onaction "macro" assigned to shape.


Excepting following solutions:
1) either to disable shape copy paste and allow shape formatting or
2) rename pasted shape with unique name.
3) any better solution from your end.

Help is highly appreciated. Thank You in advance.
 
In your code above i can't find "ShapeA_Click" marco codes and details. anyway
I wrote that it was not required for the illustration - I am only showing you what can be done :)
 
Upvote 0

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
My code does virtually everything you need in that case
If choosing shape names sequentially, VBA must test that the name does not already exist to prevent other issues

Your requirement is that the shape name must be different to any other shape on the sheet
What is your naming convention for each new shape?
 
Upvote 0

Forum statistics

Threads
1,223,933
Messages
6,175,471
Members
452,646
Latest member
tudou

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