Question Locked

How to run an excel macro in powerpoint

0 helpful
2 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

Hi there,

I have a presentation in power point with a chart on it. In office 2007 the charts are linked to excel, so if you change the data in the excel cells you will see the changes on your chart right away.
My question is: How do you run a macro from power point that change that cells?
The current macro I'm running from excel is:
mycount = Range("b2") + 100
Range("b2") = mycount

but I will like to run it from power point and I don't know how to link power point to excel.

Any advice??
Thanks in advance!!!

2 replies

by jyellis

Sub ImportData()
Dim XL As Object
Dim thisPath As String

thisPath = ActivePresentation.Path

Set XL = CreateObject("Excel.Application")

XL.Workbooks.Open thisPath & "\ABC Derailment.xls"

' If there is more than one macro called LoopShts,
' the module name would be required as in
'
' XL.Run "Module1.LoopShts"
'
' to differentiate which routine is being called.
'
XL.Run "LoopShts"

End Sub

This discussion is closed to new replies.