Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / January 2006

Tip: Looking for answers? Try searching our database.

Excel VBA Challenge: Creating a callout with exact location

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
naddad - 24 Jan 2006 22:37 GMT
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?

Signature

naddad

Bob Phillips - 24 Jan 2006 23:20 GMT
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)

> Hey all,
>
[quoted text clipped - 9 lines]
> naddad's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=29817
> View this thread: http://www.excelforum.com/showthread.php?threadid=504682
Jim Thomlinson - 24 Jan 2006 23:37 GMT
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
Signature

HTH...

Jim Thomlinson

> Hey all,
>
[quoted text clipped - 3 lines]
> callout (in AutoShapes/callouts) whose tip points to that selected
> cell. Does any guru know how to proceed about doing that in VBA?
naddad - 24 Jan 2006 23:44 GMT
Thanks, got it :)

Signature

naddad

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.