how to change the direction of elbow connector at glue of the freeform shape in excel VBA

Answered how to change the direction of elbow connector at glue of the freeform shape in excel VBA

  • Tuesday, July 17, 2012 1:58 AM
     
     

    Hi, I am a excel user.

    I am using VBA to draw some shapes.

    I draw some freeform shapes and going to connect with elbow conenctor.

    But when I connected the connector to the connected point of shape(small red square),

    it re-routed automatically with wrong direction.

    I want the direction of the arrow to be drawn from outside to inside of shape.

    But the direction is reversed automatically when I connect them by VBA.

    Can I control the directon of arrow by specific property or something?

    In addition, is there a way to control the location of yellow circle of elbow connector?

    If you have any way to solve this problem, please let me know.

    Thank you in advance for your kindness.


    • Edited by JangLuffy Tuesday, July 17, 2012 2:36 AM
    •  

All Replies

  • Tuesday, July 17, 2012 7:53 AM
    Moderator
     
     Answered

    Whether the end of a Connector connects to the inside or outside of a connection point on a Shape depends on the positioning of the little yellow square(s) you see on the Connection Lines when selected. You can grab a square and move these so that the end of the Line meets a connection point inside the Shape.Normally this Line is drawn automatically with all the Line and ends outside the Shape. But you can change that manually or programmatically.

    The lines can have Arrow heads at the 'Begin' and 'End' of line. You can add or remove arrow heads manually or programmatically, though programmatically you would need to know which end of the line was drawn first.

    Best thing to do is record a macro, change the Arrow heads and move the little yellow squares to suit. In the code look at Adjustments.

    Peter Thornton

  • Tuesday, July 17, 2012 8:29 AM
     
     

    Thank you very much for your answer, Peter.

    First, I can't record a macro when I control the shape. Is there a way to enable?

    Of course, I can record a macro when I control the value of cell, etc.

    And I know little yellow diamond can control the shape of connector.

    I can drag and drop by mouse manually, but I have a lot of connectors to change.

    So I am looking for the way to change programmatically.

  • Tuesday, July 17, 2012 9:14 AM
    Moderator
     
     

    You should be able to record a macro with Shapes, not sure why you can't. Start in the Developer tab, press Record Macro, adjust your Shapes and connectors, Stop the macro when done. I put a short cut record macro button on the QAT.

    If you have a lot of shapes to adjust I expect it will be difficult to write code to place all the connector arrows "inside" shapes. If this is a one-off task to change existing drawings probably easier to do it manually.

    Peter Thornton

  • Monday, August 06, 2012 11:47 AM
    Answerer
     
     Answered

    Dear JangLuffy,

    As I have understood for the arrow heads you can research (In VBEditor press F2] on LineFormat object's EndArrowheadStyle and BeginArrowheadStyle.

    [You can specify the lenth and width.Do a bit research]

    As an example below will set the arrow to none

    Worksheets(1).shapes(1).line.beginarrowheadstyle=msoArrowheadNone


    Asadulla Javed, Kolkata[********Please do not forget to click “Vote as Helpful” if any post helps you and "Mark as Answer" if it solves the issue.******]

  • Saturday, November 10, 2012 7:49 AM
     
     
    In excel 2012 ... The macro does not record altering shapes ????

    farmer