Användbar VBA-kod

december 12th, 2012

För att …

Uppdatera länkar mellan Excel och Powerpoint

Sub Update_Links()
Dim osld As Slide
Dim oshp As Shape
For Each osld In ActivePresentation.Slides
For Each oshp In osld.Shapes
If oshp.Type = msoLinkedOLEObject Then oshp.LinkFormat.Update
Next oshp
Next osld
End Sub

Bryta länkar mellan Excel och Powerpoint

Sub BreakLinks()
Dim oSld As Slide
Dim oShp As Shape
Dim oCmdButton As CommandBarButton
Set oCmdButton = CommandBars(”Standard”).Controls.Add(Id:=2956)
ActiveWindow.ViewType = ppViewSlide
For Each oSld In ActivePresentation.Slides
For Each oShp In oSld.Shapes
If oShp.Type = msoLinkedOLEObject Then
ActiveWindow.View.GotoSlide oSld.SlideIndex
’ Do not forget to add this line else you will get erratic
’ results since the code execution does not halt while menu
’ command is executed hence we have to let the execution
’ complete before proceeding.
End If
Next oShp
Next oSld
End Sub

Kommentarer är avstängda.