I am automating a Power Point based on VBA code and everything works perfect except when I run the macro twice and I have the excel document open to which many other shapes in the presentation are linked. The macro updates the shapes in the power point which are linked to one specific excel document. The first time I run the macro with the excel open, it updates everythging well and the second time I run the macro it sends me the error in the photo attatched. Does anyone know how I can solve this problem? The excel document never moves from place and is always on the same directory which is the company directory, not my personal computer. I don´t know if this means it is in One Drive or in the server or the company or what exactly this implicates.
Thanks for your help!
I have this code for updating the link of each shape:
Public Sub LinkformatUpdateDashboard(LF As LinkFormat, oShp As Shape, ShapeTag As String, ShapeVal As String, SldIndex As Long, Optional Einzeln As Boolean = False)
Dim PHeightOld As Single, PWidthOld As Single, PLeftOld As Single, PTopOld As Single, LockR As MsoTriState
'Stablish the parameters of the shape
With oShp
PHeightOld = .Height
PWidthOld = .Width
PLeftOld = .Left
PTopOld = .Top
End With
'Update Link
If Einzeln Or Not wbUP Is Nothing Then
LF.Update
Else
Set wbUP = GetWB(LF.SourceFullName, oShp, wbUP_IsNew)
LF.Update
End If
If Not Einzeln Then
Call UpdateProgressBar(True)
Else
GlobalShapeTagName = ShapeTag
GlobalShapeTagVal = ShapeVal
End If
Normalfall:
'alte Parameter
Call ShapeFormat(oShp, PHeightOld, PWidthOld, PLeftOld, PTopOld, msoFalse)
End If
End Sub