+ Reply to Thread
Results 1 to 4 of 4

Excel VBA Challenge: Creating a callout with exact location

  1. #1
    Registered User
    Join Date
    12-21-2005
    Posts
    9

    Excel VBA Challenge: Creating a callout with exact location

    Hey all,

    I have a table (duh, excel!). I have created a small script: If you right click any cell of that table, an entry "Insert Comment" in the context menu appears. I want the action of that entry to create a callout (in AutoShapes/callouts) whose tip points to that selected cell. Does any guru know how to proceed about doing that in VBA?

  2. #2
    Bob Phillips
    Guest

    Re: Excel VBA Challenge: Creating a callout with exact location

    One way

    Sub AddCallout()
    Dim x, y
    Dim shp As Shape
    With ActiveCell
    x = .Left
    y = .Top
    Set shp = ActiveSheet.Shapes.AddShape( _
    msoShapeRoundedRectangularCallout, _
    Left:=x, Top:=y - 120, Width:=100, Height:=100)
    End With
    End Sub

    You will need to play with the numbers to get the shape that you want. The
    connection between the bubble and the cell seems to tale 20% of its height,
    extra to its height.

    --

    HTH

    Bob Phillips

    (remove nothere from the email address if mailing direct)

    "naddad" <[email protected]> wrote in
    message news:[email protected]...
    >
    > Hey all,
    >
    > I have a table (duh, excel!). I have created a small script: If you
    > right click any cell of that table, an entry "Insert Comment" in the
    > context menu appears. I want the action of that entry to create a
    > callout (in AutoShapes/callouts) whose tip points to that selected
    > cell. Does any guru know how to proceed about doing that in VBA?
    >
    >
    > --
    > naddad
    > ------------------------------------------------------------------------
    > naddad's Profile:

    http://www.excelforum.com/member.php...o&userid=29817
    > View this thread: http://www.excelforum.com/showthread...hreadid=504682
    >




  3. #3
    Jim Thomlinson
    Guest

    RE: Excel VBA Challenge: Creating a callout with exact location

    This should give you a start...

    Public Sub AddCallout()
    Dim shp As Shape

    Set shp = ActiveSheet.Shapes.AddShape(msoShapeRoundedRectangularCallout, _
    ActiveCell.Left + ActiveCell.Width, ActiveCell.Top - 35, 75, 35)
    shp.DrawingObject.Text = "Tada!"
    End Sub
    --
    HTH...

    Jim Thomlinson


    "naddad" wrote:

    >
    > Hey all,
    >
    > I have a table (duh, excel!). I have created a small script: If you
    > right click any cell of that table, an entry "Insert Comment" in the
    > context menu appears. I want the action of that entry to create a
    > callout (in AutoShapes/callouts) whose tip points to that selected
    > cell. Does any guru know how to proceed about doing that in VBA?
    >
    >
    > --
    > naddad
    > ------------------------------------------------------------------------
    > naddad's Profile: http://www.excelforum.com/member.php...o&userid=29817
    > View this thread: http://www.excelforum.com/showthread...hreadid=504682
    >
    >


  4. #4
    Registered User
    Join Date
    12-21-2005
    Posts
    9
    Thanks, got it

+ 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