ich habe ein Problem. Auf Grund von einigen Umstellungen wurde ein Excelfile, aus dem mehr als 300 Graphen in einer PowerPoint Präsentation verlinkt waren umbenannt.
Jetzt muss ich natürliche alle Pfade der Links anpassen, damit die Graphen wieder passen, da sich das Excel jeden Monat ändert.
Ich habe leider kaum VBA Kentnisse und habe im Netz noch nichts gefunden, wie man das lösen kann, ohne stundenlang manuell alle Pfade zu ändern.
Habe dieses Makro gefunden, welches leider nicht funktioniert. Ich kann zwar beim ausführen in ppt eine neue Exceldatei auswählen, aber an den Graphen ändert sich nichts.
Ich bin echt verzweifelt und bitte um HÜÜÜÜLFE =)
Sub VerknuepfungenAendern()
Dim Praes As Presentation, Blatt As Slide, Bild As Shape
Dim vDatei As Variant, sPfad As String, sExcelFile As String
Dim NeuerPfad As String
With Application.FileDialog(msoFileDialogFilePicker)
.InitialView = msoFileDialogViewDetails
.Title = "Bitte neue Exceldatei für Verknüpfung auswählen"
.ButtonName = "Auswählen"
.InitialFileName = "*.xls*"
.AllowMultiSelect = False
If .Show = 0 Then Exit Sub
sPfad = VBA.CurDir
vDatei = .SelectedItems(1)
sExcelFile = Mid(vDatei, Len(sPfad) + 2)
End With
Set Praes = ActivePresentation
For Each Blatt In Praes.Slides
For Each Bild In Blatt.Shapes
If Bild.Type = msoLinkedOLEObject Then
If InStr(1, Bild.OLEFormat.ProgID, "Excel.Chart") > 0 Then
'Diagramm in eigenem Register
'C:\TEST\MAPPE10.XLS!Diagramm1
NeuerPfad = Bild.LinkFormat.SourceFullName
NeuerPfad = vDatei & Mid(NeuerPfad, InStr(1, NeuerPfad, "!"))
Bild.LinkFormat.SourceFullName = NeuerPfad
End If
If InStr(Bild.OLEFormat.ProgID, "Excel.Sheet") > 0 Then
If InStr(1, Bild.LinkFormat.SourceFullName, "[") > 0 Then
'Diagramm eingebettet in Tabelle
'C:\TEST\MAPPE2.XLS!Tabelle1![MAPPE2.xls]Tabelle1 Diagramm 1
NeuerPfad = Bild.LinkFormat.SourceFullName
NeuerPfad = Mid(NeuerPfad, InStr(1, NeuerPfad, "!"))
NeuerPfad = vDatei & Mid(NeuerPfad, 1, InStr(2, NeuerPfad, "!")) _
& "[" & sExcelFile & Mid(NeuerPfad, InStr(1, NeuerPfad, "]"))
Bild.LinkFormat.SourceFullName = NeuerPfad
Else
'Tabellenbereich
'C:\TEST\MAPPE10.XLS!Tabelle1!Z3S1:Z7S3
NeuerPfad = Bild.LinkFormat.SourceFullName
NeuerPfad = vDatei & Mid(NeuerPfad, InStr(1, NeuerPfad, "!"))
Bild.LinkFormat.SourceFullName = NeuerPfad
End If
End If
End If
Next
Next
End Sub
Grüße