D
Dan
With PowerPoint 2003 I could control a linked Excel file with a
control in PowerPoint. For example, I could create a spinner control,
link it to a cell in a linked Excel file, and use that to change the
numbers on a graph in that linked file.
When I ran a slideshow in PowerPoint, clicking on the spinner would
change the value in Excel, and the linked graph would update
automatically, creating the appearance that Excel didn't even exist
(though it had to be open.)
At the end of this post is the macro used to do this, from an answer
on ExpertsExchange.
So, my question is -- how can I do this in PowerPoint 2007, when the
Excel object is embedded in the PPT file (and therefore there is no
external file to reference). Is there a reference-able name for the
embedded Excel objects in PPT? Or is there a better way to do this
altogether?
Thanks
Dan
Private Sub SpinButton1_Change()
Dim xlApp As Object, wb As Object, ws As Object, shp As Shape
On Error Resume Next
Set xlApp = GetObject(, "Excel.Application")
On Error GoTo 0
If xlApp Is Nothing Then
Set xlApp = CreateObject("Excel.Application")
End If
On Error Resume Next
Set wb = xlApp.Workbooks("xlChart.xls")
On Error GoTo 0
If wb Is Nothing Then Set wb = xlApp.Workbooks.Open("C:\xlChart.xls")
xlApp.Visible = False
Set ws = wb.Worksheets("Sheet1")
ws.[D6] = SpinButton1.Value
ws.Calculate
For Each shp In Me.Shapes
If shp.Type = msoLinkedOLEObject Then
shp.LinkFormat.Update
End If
Next shp
End Sub
control in PowerPoint. For example, I could create a spinner control,
link it to a cell in a linked Excel file, and use that to change the
numbers on a graph in that linked file.
When I ran a slideshow in PowerPoint, clicking on the spinner would
change the value in Excel, and the linked graph would update
automatically, creating the appearance that Excel didn't even exist
(though it had to be open.)
At the end of this post is the macro used to do this, from an answer
on ExpertsExchange.
So, my question is -- how can I do this in PowerPoint 2007, when the
Excel object is embedded in the PPT file (and therefore there is no
external file to reference). Is there a reference-able name for the
embedded Excel objects in PPT? Or is there a better way to do this
altogether?
Thanks
Dan
Private Sub SpinButton1_Change()
Dim xlApp As Object, wb As Object, ws As Object, shp As Shape
On Error Resume Next
Set xlApp = GetObject(, "Excel.Application")
On Error GoTo 0
If xlApp Is Nothing Then
Set xlApp = CreateObject("Excel.Application")
End If
On Error Resume Next
Set wb = xlApp.Workbooks("xlChart.xls")
On Error GoTo 0
If wb Is Nothing Then Set wb = xlApp.Workbooks.Open("C:\xlChart.xls")
xlApp.Visible = False
Set ws = wb.Worksheets("Sheet1")
ws.[D6] = SpinButton1.Value
ws.Calculate
For Each shp In Me.Shapes
If shp.Type = msoLinkedOLEObject Then
shp.LinkFormat.Update
End If
Next shp
End Sub