ctempleton
New member
- Local time
- Today, 13:04
- Joined
- Sep 17, 2012
- Messages
- 2
Hello All- this is my first post to the site and I have been using Access for about six months. I have a limited but working knowledge of VBA and how it operates.
I have been trying for quite some time trying to successfully export an Access report (Access 2007) into a Power Point presentation. I have some code that successfully opens a ppt from within Access, but gives the following error message before the report is brought into ppt:
"-2147467259 Method 'AddOLEobject' of object 'shapes' failed"
Below is the code, and I highlighted in red where the error occurs:
Private Sub Command2_Click()
On Error GoTo Err_Command2_Click
Dim ppObj As PowerPoint.Application
Dim ppPres As PowerPoint.Presentation
' Open up an instance of Powerpoint and the existing template.
Set ppObj = CreateObject("PowerPoint.Application")
ppObj.Visible = True
Set ppPres = ppObj.Presentations.Open("c:\Documents and Settings\nbkkefj\Desktop\MyPowerPointTemplate.pptx")
ppObj.ActiveWindow.Selection.SlideRange.Shapes.AddOLEObject(Left:=120, Top:=110, Width:=480, Height:=320, FileName:="rptbethslaterdenovos.snp", Link:=False).Select
ppObj.ActiveWindow.Selection.Unselect
Err_Command2_Click:
MsgBox Err.Number & " " & Err.Description
Exit Sub
End Sub
Does anybody have some thoughts as to why this is not working? I sincerely appreciate any expertise on this topic!
Christian
I have been trying for quite some time trying to successfully export an Access report (Access 2007) into a Power Point presentation. I have some code that successfully opens a ppt from within Access, but gives the following error message before the report is brought into ppt:
"-2147467259 Method 'AddOLEobject' of object 'shapes' failed"
Below is the code, and I highlighted in red where the error occurs:
Private Sub Command2_Click()
On Error GoTo Err_Command2_Click
Dim ppObj As PowerPoint.Application
Dim ppPres As PowerPoint.Presentation
' Open up an instance of Powerpoint and the existing template.
Set ppObj = CreateObject("PowerPoint.Application")
ppObj.Visible = True
Set ppPres = ppObj.Presentations.Open("c:\Documents and Settings\nbkkefj\Desktop\MyPowerPointTemplate.pptx")
ppObj.ActiveWindow.Selection.SlideRange.Shapes.AddOLEObject(Left:=120, Top:=110, Width:=480, Height:=320, FileName:="rptbethslaterdenovos.snp", Link:=False).Select
ppObj.ActiveWindow.Selection.Unselect
Err_Command2_Click:
MsgBox Err.Number & " " & Err.Description
Exit Sub
End Sub
Does anybody have some thoughts as to why this is not working? I sincerely appreciate any expertise on this topic!
Christian