PDA

View Full Version : Access Breaklink in PPTx



mooseman
06-05-2012, 09:29 AM
Can anyone show me how to access the breaklinks in these two shapes?
msoEmbeddedOLEObject
ActivePresentation.Slides.Shapes.OLEFormat.Object.Worksheets(1).BreakLink

msoChart
ActivePresentation.Slides.Shapes.Chart.ChartData.BreakLink

Neither of these seems to work or are they incomplete?
Thanks in advance.

John Wilson
06-05-2012, 11:22 PM
Breaklink is a method of the Shapes LinkFormat property.

It's very unclear from your code what shape you are targetting. If Shape(3) was a linked object you could use:

Dim oshp As Shape
Set oshp = ActivePresentation.Slides(1).Shapes(3)
If oshp.Type = msoLinkedOLEObject Then _
oshp.LinkFormat.BreakLink

mooseman
06-12-2012, 05:59 AM
Thanks John.
The first one is an msoEmbeddedOLEObject (embedded excel object), not a linked object and the second is a chart created in PowerPoint (msoChart).

In the chart object, I have links in the datasheet that I would like to break and Excel object has a chart tab and a sheet1 tab that contains links I need to break.

I know what I am doing is a bit unorthodox, but it is what the client wants.

Since it is not a linked object, your example doesn't affect it.



Dim oshp As Shape
Set oshp = ActivePresentation.Slides(1).Shapes(3)
If oshp.Type = msoEmbeddedOLEObject Then
breaklink????

or

Dim oshp As Shape
Set oshp = ActivePresentation.Slides(1).Shapes(3)
If oshp.Type = msoChart Then
breaklink????

John Wilson
06-12-2012, 08:28 AM
If it's not a linked object you can't break links (To the best of my knowledge)

mooseman
06-12-2012, 09:26 AM
You can if you do it manually.
For msoChart object
Right click on chart
edit data
then in the data sheet choose data > edit links>break links

For the msaEmbeddedOLEObject
double click on object to activate it
select sheet1
then choose data > edit links>break links

Just can't do this in VBA
I can copy and paste as value, but that does mess with the chart format sometimes.

Dim oSh As Shape
Dim oSl As Slide
Dim oSheet As Object


For Each oSl In ActivePresentation.Slides
For Each oSh In oSl.Shapes

ActiveWindow.View.GotoSlide oSl.SlideIndex
If oSh.Type = msoEmbeddedOLEObject Then

' oSh.OLEFormat.Activate

With oSh.OLEFormat.Object

.Worksheets(1).Cells.Copy
.Worksheets(1).Cells.PasteSpecial Paste:=-4163 ' I don't know why this works but it does
.Sheets(1).Activate
End With

ActiveWindow.Selection.Unselect
ActiveWindow.View.GotoSlide oSl.SlideIndex

End If
Next

Next