Vba macro to edit a shape using the edit shape facility

tonywatsonhelp

Well-known Member
Joined
Feb 24, 2014
Messages
3,210
Office Version
  1. 365
  2. 2019
  3. 2016
Platform
  1. Windows
High everyone,
I'm getting really annoyed because I thought this would be easy but I can't work out the numbers I need to put in and how to do this,

So what i'm looking for is a macro that will edit a shape for me

so let's say the shape is called "Frame1"

and it is the msoShapeFrame type of shape,
This has an outer border and an inner border (that's probably not the correct way to put it), but
what I want is the outer border to stay as it is, but the inner border instead of having 90-degree corners to have curved corners say a 15% curve,

so I know it can be done by using the edit shape button and then changing the nodes to be different but I can't get it to do what I need as I'm not good at this stuff, please help if you can

if I've missed anything important you can assume it as you need to.

Thanks

Tony
 

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN
I am not offering a VBA way because doing what you want doesn’t appear possible to do manually.
What are you putting the Frame around?
msoShapeFrames is pre-set as to have rectangular inner and outer edges.
(From MS documentation it appears there is not a “Rounded msoShapeFrame”)
Yes you can “Edit the Points” of the shape but there is no means to make the internal 90 corner into a rounded one
Think the nearest you could do would be edit the inner corner points into something that vaguely looks like a rounded corner. (lot of work)

Now going back to my leading question and depending on your answer you could fit a “Rounded Rectangle” inside the frame and solid fill it white, put in it whatever your “Frame” surrounds and then group the “Frame” and the “Rounded Rectangle” together.

As always I stand to be corrected
 
Upvote 0
Hi thank you for your reply, after two days of playing around i have an idea of whats going to be needed but still need help making it happen
this code creates the shape then goes into the shape edit and make the lower right corner about a 45 degree line as aposed to the right angle it once was,
now playing around with this manualy i can create a curved corner so if i can do it it must be possible but i imagine we need someone with great maths skills or super advanced VBA knowledge to do this
heres my code to show its posible, if anyone can improve on it I would be very grateful

VBA Code:
Sub lasthope()

'    ActiveSheet.Shapes.Range(Array("Frame 2")).Delete
    ActiveSheet.Shapes.AddShape(msoShapeFrame, 48, 38.6250393701, 363, 158.25). _
        Select
    Selection.ShapeRange.Name = "Frame 2"
   With ActiveSheet.Shapes("Frame 2")
    

    .Nodes.Insert 2, msoSegmentCurve, msoEditingCorner, 100, 100
    .Nodes.Delete 2 + 1

    Dim pointsArray() As Single, x As Single, y As Single
    pointsArray = .Nodes(8).points
    x = pointsArray(1, 1) - 10

    pointsArray = .Nodes(8).points
    y = pointsArray(1, 2)

    w = 391
    r = 166

    .Nodes.Delete 8 '+ 1
    .Nodes.Insert 7, msoSegmentLine, msoEditingCorner, x + 10, y - 15
    .Nodes.Insert 7, msoSegmentLine, msoEditingCorner, x - 15, y

    
.Nodes.SetSegmentType 8, msoSegmentCurve
    

End With


End Sub
 
Upvote 0

Forum statistics

Threads
1,223,849
Messages
6,174,998
Members
452,599
Latest member
wolf1988

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