+ Reply to Thread
Results 1 to 3 of 3

Double Arrow Insert with VBA

Hybrid View

  1. #1
    Registered User
    Join Date
    08-08-2012
    Location
    Texas
    MS-Off Ver
    Excel 2007
    Posts
    14

    Double Arrow Insert with VBA

    Is it possible to insert a line with double arrows (an arrow at each end) using VBA. I want to insert a line similar to the Insert>Shapes>Double Arrow command in the ribbon.

    On a related note, is it possible to make the end of the line a flat line. In other words, rather than a triangle or oval as the arrow head, can you have it be a short flat line that is perpendicular to the main line like this --------l ?

    Thanks for the help.

    This is the code I'm currently using to insert the line. I'd like it to have double arrows.

    With Selection
            Set shp = ActiveSheet.Shapes.AddLine(.Left + .Width, .Top, .Left + .Width, .Top + .Height)
        End With
        
        With shp.Line
            .EndArrowheadStyle = msoArrowheadTriangle
            .EndArrowheadLength = msoArrowheadLengthMedium
            .EndArrowheadWidth = msoArrowheadWidthMedium
        End With

  2. #2
    Forum Expert
    Join Date
    07-15-2012
    Location
    Leghorn, Italy
    MS-Off Ver
    Excel 2010
    Posts
    3,431

    Re: Double Arrow Insert with VBA

    Sub a()
    With Selection
            Set shp = ActiveSheet.Shapes.AddLine(.Left + .Width, .Top, .Left + .Width, .Top + .Height)
        End With
        
        With shp.Line
            .EndArrowheadStyle = msoArrowheadTriangle
            .BeginArrowheadStyle = msoArrowheadTriangle
            .EndArrowheadLength = msoArrowheadLengthMedium
            .EndArrowheadWidth = msoArrowheadWidthMedium
        End With
    End Sub

  3. #3
    Registered User
    Join Date
    08-08-2012
    Location
    Texas
    MS-Off Ver
    Excel 2007
    Posts
    14

    Re: Double Arrow Insert with VBA

    Great. Thank you.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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