Ziel des Codes: Wenn PowerPoint geöffnet ist und die gesuchte Präsentation geöffnet ist, dann aktualisieren Sie es. Wenn die Präsentation geschlossen ist, öffnen Sie sie. Falls PowerPoint geschlossen ist, erstellen Sie eine neue Instanz.Excel VBA Error 467 beim Versuch, eine PowerPoint-Präsentation zu öffnen
Fehler: nach mehreren Benutzer haben es laufen auf mulitple Computern in den letzten 2 Wochen, heute einer des Benutzers erhält die folgende Fehlermeldung:
Laufzeitfehler 467: Die Remote-Server-Maschine existiert nicht oder ist nicht verfügbar
Leitungscode highlightned auf den Debug-Modus:
Set ppPres = ppProgram.Presentations.Item(i)
entsprechender Abschnitt des Modulcode:
Public Sub UpdatePowerPoint(PowerPointFile)
Dim ppProgram As PowerPoint.Application
Dim ppPres As PowerPoint.Presentation
Dim ppFullPath As String
Dim ppName As String
Dim activeSlide As PowerPoint.Slide
Dim cht As Excel.ChartObject
Dim myShape As Object
Dim myChart As Object
Dim SlideNum, GPLRank As Integer
Dim ShapeNum As Integer
Dim shapeStageStat As Shape
On Error Resume Next
Set ppProgram = GetObject(, "PowerPoint.Application")
On Error GoTo 0
ppFullPath = PowerPointFile
PPT_Export_Success = True
' check if PowerPoint instance is open
If ppProgram Is Nothing Then
Set ppProgram = New PowerPoint.Application
i = 1
Else
If ppProgram.Presentations.count > 0 Then
ppName = Mid(ppFullPath, InStrRev(ppFullPath, "\") + 1, Len(ppFullPath))
i = 1
ppCount = ppProgram.Presentations.count
Do Until i = ppCount + 1
If ppProgram.Presentations.Item(i).Name = ppName Then
Set ppPres = ppProgram.Presentations.Item(i)
GoTo OnePager_Pres_Found
Else
i = i + 1
End If
Loop
End If
End If
ppProgram.Presentations.Open Filename:=PowerPointFile
' *** Getting the ERROR at the line below ***
Set ppPres = ppProgram.Presentations.Item(i)
OnePager_Pres_Found:
ppPres.Windows(1).Activate ' activate the One-Pager Presentation in case you have several open, and the One_pager is currently not the app "on-focus"
' --- Added Class script to allow PowerPoint ScreenUpdating set to FALSE ---
Dim myClass_PPT As Class_PPT
Set myClass_PPT = New Class_PPT
myClass_PPT.ScreenUpdating = False
' loop through all PowerPoint Slides, and copy all Chart objects from Excel
For ProjectCounter = 0 To NumberofProjectShts
' copying charts, shapes and other objects
Next ' ProjectCounter = 0 To NumberofProjectShts
AppActivate ("Microsoft PowerPoint")
Set activeSlide = Nothing
Set ppPres = Nothing
Set ppProgram = Nothing
End Sub
Ich habe nichts. Ich erhalte einen Fehler, wenn ich versuche, eine Datei mit einer neuen Instanz von Power Point zu öffnen, aber 'ppProgram.Visible = msoTrue' hat das Problem behoben. Ich sehe nichts, was den Fehler verursachen würde. Konnten Sie den Fehler replizieren? –
@ThomasInzina nein, ich lief es mehr als 100 Mal auf meinem PC, aber nichts, nur 1 Benutzer hat es. Ich habe mich gefragt, ob ich diese Fehlermeldung schreiben soll? –
Wenn es noch ein paar Mal passiert. Das Problem besteht darin, dass der Server außerhalb der VBA vorhanden ist. Ich stieß auf etwas Ähnliches, das OLEObjects zu einem Arbeitsblatt hinzufügt und verweist. Der OLEObjects-Server würde die Objekte nicht freigeben, nachdem mein Makro abgeschlossen wurde. Ich musste Application.OnTime verwenden, um meine nächste Prozedur Millisekunden nach dem Abschluss meines Makros aufzurufen. –