Hi,
I made a macro that copies ranges from excel to an excisting PowerPoint presentation, using specific slide numbers. Now i want to make it more dynamic so that when one slide is added the slide the macro copies to stays the same. I've seen that i can use slideID and findbyslideID for this instead of slide number/index. The problem is that i dont know how to apply the slideID into my code. It has to go somewhere in the pasterng sub i think. Below my code. Someone who can help me further?
Function LogOff()
Dim EPMOff As New FPMXLClient.EPMAddInAutomation
EPMOff.LogOff
End Function
Function LogOn()
Dim EPMOn As New FPMXLClient.EPMAddInAutomation
EPMOn.LogOn
End Function
Sub export_to_ppt3()
application.ScreenUpdating = False
Call LogOff
Dim PPApp As PowerPoint.application
Dim PPPres As PowerPoint.Presentation
Dim ppslide As PowerPoint.Slide
On Error Resume Next
Set PPApp = GetObject(, "Powerpoint.Application")
On Error GoTo 0
If PPApp Is Nothing Then
Set PPApp = New PowerPoint.application
PPApp.Visible = True
Set PPPres = PPApp.Presentations.Open("I:\path")
Else
Set PPPres = PPApp.ActivePresentation
End If
PPApp.ActiveWindow.ViewType = ppViewSlide
application.DisplayAlerts = False
PasteRng PPPres, 472, Blad1.Range("K75:Z116")
PasteRng PPPres, 485, Sheet3.Range("I24:O142")
PasteRng PPPres, 476, Blad1.Range("K117:Z159")
PasteRng PPPres, 429, Blad4.Range("B35:G170")
PasteRng PPPres, 471, Blad23.Range("J25:AW91")
PasteRng PPPres, 470, Blad20.Range("F34:AT171")
' Clean up
Set ppslide = Nothing
Set PPPres = Nothing
Set PPApp = Nothing
Call LogOn
application.ScreenUpdating = True
End Sub
Sub PasteRng(pres, SlideNo, rng As Range)
rng.Copy
pres.application.ActiveWindow.View.GotoSlide SlideNo
pres.application.ActiveWindow.View.PasteSpecial ppPasteOLEObject, msoFalse
End Sub
many thanks in advance!
Bookmarks