We help IT Professionals succeed at work.

ASP and PowerPoint

Stanciu
Stanciu asked
on
How can I use PowerPoint objects in ASP?
I need to save a ppt file as JPEG components from inside ASP code.

Thanx,
Horatiu Stanciu
Comment
Watch Question

Commented:
Stanciu,

Try this:

<%

theformat = 4 'i am no sure is what variable, you can try from 1 - 16

Set wrd = CreateObject("Word.Application")
wrd.Documents.Open Server.MapPath("aa.ppt")
wrd.Visible = False

wrd.Application.ActivePresentation.SaveAs Server.MapPath("aa.jpg"), theformat
wrd.Application.quit
Set wrd = Nothing

%>

Regards,
Wee Siong
Commented:
Stanciu,

These one got problem, please try this:

<%
On Error Resume Next

ppSaveAsHTML = 17
Set Wrd = CreateObject("PowerPoint.Application")
wrd.Visible = True
Wrd.Presentations.Open (Server.MapPath("power.ppt"))
wrd.ActivePresentation.SaveAs Server.MapPath("aa.jpg"), ppSaveAsHTML
wrd.quit
Set wrd = Nothing

IF Err.Number > 0 Then
     Err.Raise 6  ' Raise an overflow error.
     Response.Write "Error # " & CStr(Err.Number) & " " & Err.Description & VBCRLF & "<br>"
     Err.Clear    ' Clear the error.
End IF
%>

ppSaveAsHTML = 16 ' For Gif

Regards,
Wee Siong

Author

Commented:
I don't know ASP, I know a little VB, I roughly put your code in an ASP page (IIS installed), but nothing happened. Can you give me some details?

Thanx,
H

Commented:
Stanciu,

<%
On Error Resume Next

ppSaveAsHTML = 17
Set Wrd = CreateObject("PowerPoint.Application")
wrd.Visible = True
Wrd.Presentations.Open (Server.MapPath("power.ppt"))
wrd.ActivePresentation.SaveAs Server.MapPath("aa.jpg"), ppSaveAsHTML
wrd.quit
Set wrd = Nothing

IF Err.Number > 0 Then
    Err.Raise 6  ' Raise an overflow error.
    Response.Write "Error # " & CStr(Err.Number) & " " & Err.Description & VBCRLF & "<br>"
    Err.Clear    ' Clear the error.
Else
    Response.Write "Convert To JPEG Successfully"
End IF
%>

Regards,
Wee Siong

Commented:
Stanciu,

After succefully, you can goto the Folder for the asp, you can see have a new folder call aa, and you can see have a jpg file insert in the folder :)

Good Luck!

Regards,
Wee Siong
Admin notified of user neglect. Force/accepted by

Netminder
Community Support Moderator
Experts Exchange

Explore More ContentExplore courses, solutions, and other research materials related to this topic.