I wrote a VBA macro in Excel 2007 in Windows XP to copy data from an Excel spreadsheet to a PowerPoint presentation. When this macro included table was run on a new installation of Windows 7, it fails. So I pulled out code that could not indicate the problem, and it does not seem to work while trying to open an existing PowerPoint file. I tried to run this code in both Office 2010 and Office 2007.
The code I'm trying to use (only parts of the problem shown below)
Sub test()
Dim PowerPointApplication As PowerPoint.Application
Dim PowerPointFile As PowerPoint.Presentation
Set PowerPointApplication = CreateObject("PowerPoint.Application")
Set PowerPointFile = PowerPointApplication.Presentations.Open("PATH_TO_FILE\test.pptx")
End Sub
The macro does not work on the Presentations.Open line above with the following error
Run-time error '-2147467259 (80004005)':
Method 'Open' of object 'Presentations' failed
PowerPoint 12.0 VBEditor . , Windows XP.
-. - Windows 7 , , .
- pptx, , .
Windows:
Windows 7 Professional
Service Pack 1
64 Bit
!