|
-
Jun 24th, 2003, 08:05 AM
#1
Thread Starter
New Member
asp to powerpoint
Hi,
I am trying to do dynamic PowerPoint presentations using ASP. I get the following error message:
Error Type:
Microsoft PowerPoint 2002 (0x80070057)
Slides.Add : Invalid enumeration value.
/itp/html2ppt.asp, line 15
with the following code
<% Response.ContentType = "application/vnd.ms-powerpoint" %>
<%
Dim ppApp
Set ppApp = CreateObject("Powerpoint.Application")
' Make it visible.
ppApp.Visible = True
' Add a new presentation.
Dim ppPres
Set ppPres = ppApp.Presentations.Add(msoTrue)
' Add a new slide.
Dim ppSlide1
Set ppSlide1 = ppPres.Slides.Add(1,ppLayoutTitleOnly)
' Add some text.
ppSlide1.Shapes(1).TextFrame.TextRange.Text = "My first slide"
ppSlide1.Shapes(2).TextFrame.TextRange.Text = "Automating Powerpoint is easy" & vbCr & "Using Visual Basic is fun!"
%>
Is this even the right way to do it and do you know some good resources for asp to powerpoint applications. Thanx a lot!
-Jani
-
Jun 24th, 2003, 03:19 PM
#2
Frenzied Member
<%..%> tags identifues server side VBScript (ASP) code, but you trying to use client side VBscript on the server. It's not gonna work.
here changes in red
Code:
<% Response.ContentType = "application/vnd.ms-powerpoint"
Dim ppApp
Set ppApp = Server.CreateObject("Powerpoint.Application")
' Make it visible.
ppApp.Visible = True
' Add a new presentation.
Dim ppPres
Set ppPres = ppApp.Presentations.Add(msoTrue)
' Add a new slide.
Dim ppSlide1
Set ppSlide1 = ppPres.Slides.Add(1,1)
' Add some text.
ppSlide1.Shapes(1).TextFrame.TextRange.Text = "My first slide"
ppSlide1.Shapes(2).TextFrame.TextRange.Text = "Automating Powerpoint is easy" & vbCr & "Using Visual Basic is fun!"
%>
-
Jun 24th, 2003, 05:29 PM
#3
Hyperactive Member
Originally posted by andreys
<%..%> tags identifues server side VBScript (ASP) code, but you trying to use client side VBscript on the server. It's not gonna work.
[/code]
How is he trying to use client side code on the server? You dont need to instantiate components with server.createobject, the createobject method will work just fine server side, however using server.createobject has its benefits :
http://msdn.microsoft.com/library/de...er01242000.asp
--
Anglo Saxon
-
Jun 25th, 2003, 10:06 AM
#4
Frenzied Member
You are right, Anglo Saxon. Mist that.
-
Jun 27th, 2003, 03:00 AM
#5
Thread Starter
New Member
Thanks for your help. I still can't make it work. PowerPoint opens fine but it does not make a new slide. What's wrong with the code?
BR
Jani
-
Nov 13th, 2008, 08:01 AM
#6
New Member
Re: asp to powerpoint
The instruction [Response.ContentType = "application/vnd.ms-powerpoint"] just bring to PowerPoint the things that I write directly on the file, with response.write or out of <%%>. The others instructions seems do nothing, but create a process in the computer, powerpoint.exe. Did someone know what's happening?
-
Nov 13th, 2008, 08:52 AM
#7
New Member
Re: asp to powerpoint
It works
Max = 31
Set PP = server.CreateObject("PowerPoint.Application")
PP.Visible = True
Set Apres = PP.Presentations.Add()
For xyz=1 To Max
response.write xyz
Set Slides = Apres.Slides.Add(1,xyz)
Next
Apres.saveas [--FILE NAME--]
PP.Quit
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|