Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Automating Reports From Excel to PowerPoint 1

Status
Not open for further replies.

originalxavier

Programmer
Mar 5, 2003
69
US
Hello all,

I am having some trouble. I am trying to automate some reports where the data is returned to excel and the appropriate charts are created as new sheets. What I am having trouble with is getting the VBA code in Excel to open an existing PowerPoint presentation (with no user input) and paste the slides into the presentation. Here is what I have so far but I am more than willing to completely throw this out for code that works...

Sub test()
Dim report As String

report = "h:\cccreports\ccc_report.ppt"
Presentations.Open filename:=report, _
ReadOnly:=False
Windows("ccc_report.ppt").Activate
End sub

When I run this code, I get an error "ActiveX component can't create object." Obviously, something is missing, but I HAVE referenced the PowerPoint 9.0 library.

Any help is appreciated.
 
You have set a reference to PP, but you haven't told the code you are going to use it!

Sub test()
Dim ppt As New PowerPoint.Application
Dim report As String

report = "h:\cccreports\ccc_report.ppt"

ppt.Presentations.Open FileName:=report, _
ReadOnly:=False
ppt.Windows("ccc_report.ppt").Activate
End Sub


That should work now.

hth

Ben ----------------------------------------------
Ben O'Hara

"Where are all the stupid people from...
...And how'd they get so dumb?"
NoFX-The Decline
----------------------------------------------
 
Unfortunately, I am getting another error:

Run-Time Error '-214788160 (80048240)':
Presentations (unknown member): Invalid request. The powerpoint frame window does not exist.

It also did not open the pres. "Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far the Universe is winning."
Rich Cook
 
Hmm!
Unlike Excel & Access you need to make PowerPoint visible before you can do anything so:
Sub test()
Dim ppt As New PowerPoint.Application
Dim report As String

report = "G:\apps\windows\Power_pt\ACPO Conf speech.ppt"
ppt.Visible = True
ppt.Presentations.Open FileName:=report, _
ReadOnly:=False
ppt.Windows(1).Activate
End Sub


worked on my machine.

hth

Ben ----------------------------------------------
Ben O'Hara

"Where are all the stupid people from...
...And how'd they get so dumb?"
NoFX-The Decline
----------------------------------------------
 
That's the fix! Thanks a lot
Xavier "Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far the Universe is winning."
Rich Cook
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top