+ Reply to Thread
Results 1 to 4 of 4

Draw a line connector dynamically between 2 command buttons

  1. #1
    Registered User
    Join Date
    05-30-2014
    Posts
    5

    Draw a line connector dynamically between 2 command buttons

    Hello Team,

    I have two command buttons in my excel. I want to draw a line connector between them dynamically.
    The inputs I have at run time are : the command button names. Is it possible to draw a connector between them just by knowing their names ?

  2. #2
    Registered User
    Join Date
    05-30-2014
    Posts
    5

    Re: Draw a line connector dynamically between 2 command buttons

    yes got the answer :
    ActiveSheet.Shapes.AddConnector(msoConnectorElbow, cmd1.Left, _
    cmd1.Top, cmd1.Width, cmd1.Height).Select
    Selection.ShapeRange.Line.EndArrowheadStyle = msoArrowheadTriangle
    Selection.ShapeRange.Flip msoFlipHorizontal
    Selection.ShapeRange.Flip msoFlipVertical
    Selection.ShapeRange.ConnectorFormat.BeginConnect ActiveSheet.Shapes( _
    "cmd1"), 3
    Selection.ShapeRange.ConnectorFormat.EndConnect ActiveSheet.Shapes("cmd2" _
    ), 1

  3. #3
    Registered User
    Join Date
    05-30-2014
    Posts
    5

    Re: Draw a line connector dynamically between 2 command buttons

    Hello Team,

    One more qn. pls . In the below code,
    ActiveSheet.Shapes.AddConnector(msoConnectorElbow, cmd1.Left, _
    cmd1.Top, cmd1.Width, cmd1.Height).Select

    cmd1 is the command button name. Can I assign a String variable as follows :

    Dim mybutton as String
    mybutton = "cmd1"

    then how will I rewrite the above statement using mybutton. Also how will i write the below command using mybutton.

    Selection.ShapeRange.ConnectorFormat.EndConnect ActiveSheet.Shapes("cmd1" _
    ), 1

  4. #4
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Draw a line connector dynamically between 2 command buttons

    You can't use mybutton in that code, it's only a string.
    If posting code please use code tags, see here.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Looping through dynamically created command buttons
    By newbi004 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-28-2014, 10:39 AM
  2. How to draw elbow connector using macros vba
    By swetha182 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-25-2013, 09:14 AM
  3. Replies: 3
    Last Post: 07-16-2013, 08:06 AM
  4. Useform Code - 12 Command Buttons dependant on other command buttons
    By darrenkaye in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-20-2013, 10:58 AM
  5. connector line between vlookup and list.
    By mostakimm in forum Excel General
    Replies: 0
    Last Post: 01-26-2006, 01:26 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1