Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using Excel Chart Event Procedures when embedded in PowerPoint 1

Status
Not open for further replies.

hitoshi

Programmer
Jul 26, 2004
8
CA
Hi,

Say I've declared a procedure in Excel, with a chart on a seperate sheet, that msgboxes what the value of the series is when you mouseover it, something like this:

>>



Private Sub Chart_MouseMove(ByVal Button As Long, _
ByVal Shift As Long, ByVal X As Long, ByVal Y As Long)
Dim IDNum As Long
Dim a As Long
Dim b As Long

ActiveChart.GetChartElement X, Y, IDNum, a, b
msgbox IDNum
end sub



>>>.


If I paste this chart into Powerpoint I have not found an easy way to access this prcoedure. I know you can set ActionSettings and I suppose you could call another sub that is given a reference to the shape.oleformat.object, but this seems far too hard.

Any thoughts?

Thanks alot,

Greg
 
Hi,

Your procedure did not do what I believe you wanted. I modified it to display the SERIES and POINT values as yo move your cursor over a SERIES.

FIRST insert a RECTANGLE on your chart..
Code:
Private Sub Chart_MouseMove(ByVal Button As Long, _
        ByVal Shift As Long, ByVal X As Long, ByVal Y As Long)
    Dim IDNum As Long
    Dim a As Long
    Dim b As Long

    ActiveChart.GetChartElement X, Y, IDNum, a, b
    With ActiveChart.Shapes(1)
      If IDNum = xlSeries Then
         .TextFrame.Characters.Text = "Series: " & a & " Point: " & b
         .Top = Y - 100
         .Left = X - 100
         .Visible = True
      Else
         .Visible = False
      End If
   End With
End Sub
I have a problem with POSITIONING the RECTANGLE.

Now about PowerPoint. If you ACTIVATE the Excel Chart, the procedure will work.

:)

Skip,

Want to get great answers to your Tek-Tips questions? Have a look at faq222-2244
 
OK! Your code works great in excel, and in powerpoint if you are not presenting. By while the presentation is not running I do not how to get this macro to run. I tried this:

-set the pasted chart's action setting to run the macro called "display" on a mouseover
-then made this macro:

Sub display(ByRef oShp As Object)
oShp.OLEFormat.DoVerb Index:=1
End Sub

Now this should do activate the graph. But it doesn't seem to. Anymore thoughts?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top