Results 1 to 7 of 7

Thread: asp to powerpoint

  1. #1

    Thread Starter
    New Member
    Join Date
    Jun 2003
    Location
    Helsinki, Finland
    Posts
    2

    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

  2. #2
    Frenzied Member andreys's Avatar
    Join Date
    Sep 2002
    Location
    Los Angeles
    Posts
    1,615
    <%..%> 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!"
    
    %>

  3. #3
    Hyperactive Member Anglo Saxon's Avatar
    Join Date
    Mar 2002
    Location
    Durham, UK
    Posts
    259
    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

  4. #4
    Frenzied Member andreys's Avatar
    Join Date
    Sep 2002
    Location
    Los Angeles
    Posts
    1,615
    You are right, Anglo Saxon. Mist that.

  5. #5

    Thread Starter
    New Member
    Join Date
    Jun 2003
    Location
    Helsinki, Finland
    Posts
    2
    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

  6. #6
    New Member
    Join Date
    Nov 2008
    Posts
    3

    Exclamation 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?

  7. #7
    New Member
    Join Date
    Nov 2008
    Posts
    3

    Thumbs up 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
  •  



Click Here to Expand Forum to Full Width