PowerPoint VBA per rompere i collegamenti in Oleformat Object
-
13-12-2019 - |
Domanda
Ho una diapositiva PowerPoint 2007 con due oggetti Excel incorporati. Voglio accedere al foglio1 scheda ea interrompere tutti i collegamenti. Stavo cercando di copiare e incollare per valore, ma sono bloccato, anche se il codice funziona, non fa nulla. Qualsiasi aiuto è molto apprezzato.
Dim OSL come scivolo Dim Osheet come oggetto Dim PPPapp come PowerPoint.Application Dim PPPRES come PowerPoint.Presentation
per ogni OSL in Activepresentation.slides Per ogni OSH in OSL.Shapes
ActiveWindow.View.GotoSlide oSl.SlideIndex
If oSh.Type = msoEmbeddedOLEObject Then
oSh.OLEFormat.Activate
With oSh.OLEFormat.Object
.Application.Workbooks(1).Worksheets(1).Cells.Copy
.Application.Workbooks(1).Worksheets(1).Cells.PasteSpecial Paste:=xlPasteValues
End With
ActiveWindow.Selection.Unselect
ActiveWindow.View.GotoSlide oSl.SlideIndex
End If
Next
.
Avanti Fine sub
Soluzione
Aggiornato / modificato ... Salta la linea di aggiornamento dell'applicazione, prova come così invece:
If oSh.Type = msoEmbeddedOLEObject Then
With oSh.OLEFormat.Object ' added .Object here
.Activate
.Application.workbooks(1).worksheets(2).Cells.Copy
.Application.workbooks(1).worksheets(2).Cells.PasteSpecial Paste:=xlPasteValues
End With
End if
.
Prima, definisci un costante LXPasteValues a lungo= -4163 o sostituire XlPasteValues con -4163 nel codice sopra.