Very strange: Err.Number = -2147023170

T

Trigger

I'm getting a very strange error when I try to run the follwing code
(in ASP):

<%
sub closePPT()
Dim PPTobj
set PPTobj = CreateObject("Powerpoint.Application")
PPTobj.Visible = True
On Error Resume Next
PPTobj.Quit '<-- Error occurs here
response.write(Err.Number)
response.write(Err.Description)
set PPTobj = Nothing
End sub

closePPT
%>

The output is "-2147023170" for Err.Number, and no value/blank for
Err.Description. It does indeed start an instance of Powerpoint, and
it throws this error on the "PPTobj.Quit" method. The really odd part
is that it used to work flawlessly, I haven't changed this part of the
script, and nothing (i.e. permissions) has changed on the web-server
either. The web server is running win2k service pack 4. I really need
to resolve this asap, if anyone could offer a suggestion I would very
much appreciate it!

- Tristan
 
S

Shyam Pillai

Trigger,
I can't reproduce it. What is the version of PowerPoint in use? Are you
running it under a multi-instance scenario because PPT is a single instance
application.

--
Regards
Shyam Pillai

Toolbox for PowerPoint
http://www.mvps.org/skp/toolbox
 
T

Trigger

Hi Shyam,
I found this article on support.microsoft.com:

http://support.microsoft.com/default.aspx?scid=kb;en-us;300367

I believe it may have something to do win Win2K and COM having issues
after Service Pack 3. The recommended fix is to install SP4, but that
was already installed. Starting and stopping the com and rpc
processes made no difference. I may have to try running it on XP.

I hope you don't mind though I DO have another question - I'm getting
another strange error like this when I try to insert a blank slide:

Set newPres = PPTobj.Presentations.Add(True)
'This code inserts the ppt or jpg slides from another file into
'the current active presentation.
numFiles = Ubound(infile) + 1 'number of files in the array.
i = 0
Do
fileExt = fso.GetExtensionName(infile(i))
If fileExt = "jpg" Then
'Add a blank slide and insert picture.
set newSlide = newPres.Slides.Add(i, ppLayoutBlank)

'*** The .Add method is where Err.Number = -2147024809 ***
'Error.Description returns: "Slides.Add : Invalid enumeration value."
'even though I know for certain that it is within the correct index
range.

'This method inserts the picture into the CURRENT slide.
With newSlide.Shapes
set newPicture = .AddPicture(infile(i), _
False, True, 1, 1, 70, 70)
End With
' Now scale the image to fit the slide.
newPicture.ScaleHeight 1, True
newPicture.ScaleWidth 1, True

Else 'Insert the slide AFTER slide index "i"
Call newPres.Slides.InsertFromFile (infile(i), i)

End If
i = i + 1
Loop Until i = numFiles

etc....
From the examples I've looked at, I can't really see what I'm doing
wrong. Any ideas?
Thanx

- Tristan
 
S

Shyam Pillai

Tristan,
set newSlide = newPres.Slides.Add(i, ppLayoutBlank)
You need to set a reference to PowerPoint library to be using ppLayoutBlank
(a defined constant) else use the value instead (12 ).
Errors like this could be easily avoided if you use the Option Explicit
statement in every module.

--
Regards
Shyam Pillai

Handout Wizard
http://www.mvps.org/skp/how/
 
T

Trigger

Thanx Shyam, using "12" as a parameter worked! This code is running
in an ASP, how would I set a reference to the PowerPoint library?
 
S

Steve Rindsberg

Set newPres = PPTobj.Presentations.Add(True)
'This code inserts the ppt or jpg slides from another file into
'the current active presentation.
numFiles = Ubound(infile) + 1 'number of files in the array.
i = 0
Do
fileExt = fso.GetExtensionName(infile(i))
If fileExt = "jpg" Then
'Add a blank slide and insert picture.
set newSlide = newPres.Slides.Add(i, ppLayoutBlank)

'*** The .Add method is where Err.Number = -2147024809 ***
'Error.Description returns: "Slides.Add : Invalid enumeration value."
'even though I know for certain that it is within the correct index
range.

You've set i=0 and are using i as the index ... it'll always be zero, no?
The index must be >=1
 
T

Trigger

You're right, I already fixed it by using .Add((i+1), 12), as it was
inserting the new slide before, not after the current slide. I'm also
using i to index an array i.e. the idea is to insert presentation at
array(i) into index (i+1) in the presentation.

I'm running this as an ASP, I'm still curious though, Shyam mentioned
I should link to the powerpoint library so that I can use pre-defined
constants like "ppLayoutBlank" instead of "12" in the .Add method.
How would I do this? Sorry if my questions seem obvious, I'm still
kinda new at this.

Tristan
 
S

Steve Rindsberg

Hi,

In VB or VBA you'd set a reference to the PowerPoint library (Tools,
Reference); when you define a new object as a PPT object, you'd then be able
to use PPT's internal constants. I'm afraid I've no idea how you'd do the
same thing in ASP.

Can somebody else fill in the blanks here?

--
Posted to news://msnews.microsoft.com
Steve Rindsberg, PPT MVP
PowerPoint FAQ - www.pptfaq.com
PPTools - www.pptools.com
===============================
 
J

John Langhans [MSFT]

Hello Tristan,

Since PowerPoint is not designed or intended to be run as an unattended
service on a server, I wonder if you would provide the following
information so that we can factor your answers into our design decisions:

1) Why are you attempting to automate PowerPoint through *.ASP
2) Are there features/enhancements to PowerPoint's UI (or OM) that would
facilitate the type of solution you are trying to build on top of
PowerPoint?
3) Can you think of any features/enhancements to PowerPoint (UI, Licensing,
etc.) which would eliminate the need for a server side scripting of
PowerPoint for your scenario?

John Langhans
Microsoft Corporation
Supportability Program Manager
Microsoft Office PowerPoint for Windows
Microsoft Office Picture Manager for Windows

For FAQ's, highlights and top issues, visit the Microsoft PowerPoint
support center at: http://support.microsoft.com/default.aspx?pr=ppt
Search the Microsoft Knowledge Base at:
http://support.microsoft.com/default.aspx?pr=kbhowto

This posting is provided "AS IS" with no warranties, and confers no rights.
Use of any included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm
 
T

Trigger

Hi John,

The goal of my project is to allow user(s) to make a selection of
slides he/she wishes to download from a web page (using a form). The
asp then runs powerpoint, merges the slides into a single
presentation, saves it as a randomly generated file and sends it back
to the user. (I pretty much have to use Powerpoint as a server).
Some problems I have run into:

- ActiveX "cannot create object powerpoint.application" when I try to
run two instances of the script (say, for two or more people browsing
the web site at the same time), so I've had to queue them. This
causes problems with performance, but almost more importantly it
relies on this single instance of Powerpoint to close without
crashing. Interestingly enough, when the same code is run as a .vbs
locally on the server, no errors are generated (I know Powerpoint is a
single instance app.). This brings me to my next point...

- It would really help if powerpoint were a multi-instance
application. The whole queueing/activeX problem would probably be a
non-issue.

- I've been looking into how I can preserve the templates of slides
that are being merged into a single presentation. The consensus is
that this is not possible from a scripting standpoint, but only from
the user-interface. I hope I'm wrong on this point, or at least I
hope I can find a way around this without having to link to multiple
presentations and multiple files which the user has to download. (any
suggestions?)

From what I can see, there seems to be considerable interrest in
running powerpoint as a service/server, especially in the
pharmaceutical industry where keeping track of and manipulating
thousands of slides seems to becoming increasingly common.
I have no problem with the user interface really, so far I've dealt
mostly with automation.

- Tristan
 
J

John Langhans [MSFT]

Thanks Tristan,

Rather than focusing on how you are currently trying to solve the issue,
let me see if I understand the actual scenario (what you want the end user
experience to be)

So, if I understand the scenario, you require a solution that allows the
end user to select several slides from some kind of storage (in your
current implementation a web form that is a front end to some kind of
database of slide?) so that the customer ends up with a new presentation
consisting of the slides selected.

Currently, PowerPoint does not have built in capabilities to manage or
publish collections of presentations and slides (including, for example,
previews and searchable database) in order to facilitate the reuse of
existing content. There are a variety of 3rd party tools available for
performing varieties of management, search and retrieval tasks for "digital
assets" including the kinds of assets created and used by PowerPoint
(slides, presentations, movies, pictures, etc.). They range all the way
from products which focus specifically on PowerPoint assets to enterprise
wide solutions for managing all kinds of digital assets.

Some of them include (in no particular order of preference and WITHOUT any
implied recommendation):

* Presentation Librarian - Accent Technologies
* PowerSearch - Accent Technologies
* Cumulus Office Suite - Canto
* Teams - Artesia

And most of the growing number of 3rd party solutions for capturing and
archiving recorded presentation 'casts include server-side tools for
mangement (search, access control, retrieval, etc.)

If you (or anyone else reading this message) feel strongly that PowerPoint
should include some features for managing and publishing presentations and
presentation content for easy retrieval and reuse (without having to resort
to VBA or add-ins), don't forget to send your feedback to Microsoft at:

http://register.microsoft.com/mswish/suggestion.asp

As with all product suggestions, it's important that you not just state
your wish but also why it is important to you that your product suggestion
be implemented by Microsoft. Microsoft receives thousands of product
suggestions every day and we read each one but, in any given product
development cycle, there are only sufficient resources to address the ones
that are most important to our customers so take the extra time to state
your case as clearly and completely as possible.

IMPORTANT: Each submission should be a single suggestion (not a list of
suggestions).

John Langhans
Microsoft Corporation
Supportability Program Manager
Microsoft Office PowerPoint for Windows
Microsoft Office Picture Manager for Windows

For FAQ's, highlights and top issues, visit the Microsoft PowerPoint
support center at: http://support.microsoft.com/default.aspx?pr=ppt
Search the Microsoft Knowledge Base at:
http://support.microsoft.com/default.aspx?pr=kbhowto

This posting is provided "AS IS" with no warranties, and confers no rights.
Use of any included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top