harriekepser
Nieuwe gebruiker
- Lid geworden
- 9 mei 2014
- Berichten
- 1
Hallo,
Ik gebruik onderstaande code in een excel macro
Sub Copytoppt()
Dim objPPT As Object
Dim PPSlide As Slide
Dim XLApp As Excel.Application
Set objPPT = CreateObject("PowerPoint.Application")
objPPT.Visible = True
objPPT.Presentations.Open "H:\Commercie\Offerte, SLA & presentatie documenten\Offerte\Offerte\Offerte Stap3 Prijsconfiguratie & SLA voorstel Cloud.ppt"
' Reference existing instance of Excel
Set XLApp = GetObject(, "Excel.Application")
' Copy the range
XLApp.Range("A1:K1" & LastRow).Copy
' Paste the range
PPSlide.Shapes.PasteSpecial DataType:=ppPasteOLEObject, Link:=msoFalse
' Align the pasted range
Application.ActiveWindow.Selection.ShapeRange.Alig n msoAlignCenters, True
Application.ActiveWindow.Selection.ShapeRange.Alig n msoAlignMiddles, True
' Clean up
Set PPSlide = Nothing
Set XLApp = Nothing
End Sub
Bij de regel onder ' Paste the range krijg ik een "error 91 object variable or with block variable not set".
Ik begrijp niet waarom
Iemand enig idee ?
Ik gebruik onderstaande code in een excel macro
Sub Copytoppt()
Dim objPPT As Object
Dim PPSlide As Slide
Dim XLApp As Excel.Application
Set objPPT = CreateObject("PowerPoint.Application")
objPPT.Visible = True
objPPT.Presentations.Open "H:\Commercie\Offerte, SLA & presentatie documenten\Offerte\Offerte\Offerte Stap3 Prijsconfiguratie & SLA voorstel Cloud.ppt"
' Reference existing instance of Excel
Set XLApp = GetObject(, "Excel.Application")
' Copy the range
XLApp.Range("A1:K1" & LastRow).Copy
' Paste the range
PPSlide.Shapes.PasteSpecial DataType:=ppPasteOLEObject, Link:=msoFalse
' Align the pasted range
Application.ActiveWindow.Selection.ShapeRange.Alig n msoAlignCenters, True
Application.ActiveWindow.Selection.ShapeRange.Alig n msoAlignMiddles, True
' Clean up
Set PPSlide = Nothing
Set XLApp = Nothing
End Sub
Bij de regel onder ' Paste the range krijg ik een "error 91 object variable or with block variable not set".
Ik begrijp niet waarom
Iemand enig idee ?