APD Toronto
asked on
Accessing a Embedded Sheet
Hi Experts,
I received a PowerPoint with a chart object. If I right-click the chart, then Edit Data, I see a Excel sheet.
Is there a way to directly accessing this sheet (not by right-clicking the chart)?
Thanks!
I received a PowerPoint with a chart object. If I right-click the chart, then Edit Data, I see a Excel sheet.
Is there a way to directly accessing this sheet (not by right-clicking the chart)?
Thanks!
ASKER
Can you access it physically, in design mode?
Could you be more precise?
ASKER
Sorry I was away, but from your VBA code above how can I find our what shape number is my chart, because I have a lot of objects on my slide?
I inserted your code, but it does not work and I think the shape number is my issue.
I inserted your code, but it does not work and I think the shape number is my issue.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
How can I name my shape?
it is named automatically if not done with vba
have you tried my second code?
have you tried my second code?
ASKER
I have been doing VBA for 15+ Years, but this is my first time within PowerPoint and I find it very awkward. For example, if there is an error, simply nothing happens (even with Option Explicit on) and there is no error reported, so I end up placing message boxes to isolate problematic code blocks.
That said, I broke up your code as follows
With this in place, I'm getting "vals reset", but not "assigned chart". What's wrong?
That said, I broke up your code as follows
'.....
'...
ActivePresentation.Slides(intNextSlide).Shapes("txtGrowth").OLEFormat.Object.Text = "--"
ActivePresentation.Slides(intNextSlide).Shapes("txtCirius").OLEFormat.Object.Text = "--"
MsgBox "vals reset"
'reset chart values
Dim objChart As Chart
Dim shp As Shape
'getChart intSlide:=intNextSlide, objChart:=objChart
For Each shp In ActivePresentation.Slides(intNextSlide).Shapes
If shp.HasChart Then
Set objChart = shp
Exit For
End If
Next
MsgBox "assigned chart"
End Sub
With this in place, I'm getting "vals reset", but not "assigned chart". What's wrong?
Could you send a dummy?
ASKER
Got it with a few tweaks
Thanks
Option Explicit
Sub reset()
Dim intCount As Integer
intCount = ActivePresentation.Slides(1).Shapes("txtCount").OLEFormat.Object.Text
ActivePresentation.Slides(1).Shapes("txtCount").OLEFormat.Object.Text = intCount + 1
'Get chart object's name
Dim strChartName As String
strChartName = getChartName(1)
With ActivePresentation.Slides(1).Shapes(strChartName).Chart.ChartData
.Activate ' Activate Excel
.Workbook.Application.Visible = False
.Workbook.Sheets(1).Range("B3").Value = intCount
'Set myRange = .Workbook.Sheets(1).UsedRange
'MsgBox myRange.Address
.Workbook.Close
End With
End Sub
Function getChartName(intSlide As Integer) As String
Dim shp As Shape
For Each shp In ActivePresentation.Slides(1).Shapes
If shp.HasChart Then
getChartName = shp.Name
Exit For
End If
Next
End Function
Thanks
pls try something like this
Open in new window
Regards