URGENT HELP: PPT AUTOMATION SAVE PROBLEM !!!

T

technoknight

Hello,
I am into powerpoint Automation. Let me first describe what I m trying to
do. The expected behaviour is:
1) I open a powerpoint presentation.
2.) Run my Powerpoint Automation Application.
3) When I click a button "Save" on my custom application, it should add some
effects(using a function called addeffects) and save my powerpoint onto a
specified location i.e. c:\temp\savedppt.ppt (in my case).

When I trace my code in the debug mode my application saves the current ppt
with the name specified, opens the ppt, add effects, saves it and closes it.
I can see a file "avedppt.ppt" at c:\temp.

But, When I implement my code as dll, it will not save the powerpoint file.
Rather it will go to the error handler in my code.

My functions to do all these steps is as follow:

************************************************************
Public Function Pack(FileLocation As String)

On Error GoTo err_handle:
Dim oPres
Dim FileName As String


If FileLocation <> "" Then
App_.ActivePresentation.SaveCopyAs(FileLocation)

TRACE "Presentation has been saved as:" & FileLocation

Set oPres = App_.Presentations.Open(FileLocation, , False)

TRACE "Presentation opened for Adding effects"

AddEffects 'my effects adding function which runs fine

TRACE "Effects added"

oPres.Save

TRACE "Presentation saved with effects"

oPres.Close

TRACE "Packed presentation closed"\
End If
Exit Function

err_handle:
TRACE "The function to add effects was called but it failed.The filename
was" & FileLocation, "False"
TRACE Err.Description, "False"
End Function
**********************************************************

Can someone please tell me why my code is not working fine when I implement
it as dll, although its running fine in the trace mode?

Thanks.
 
M

Mike M.

Can't see enough of your code for serious debugging. Some suggestions:
1. Are you specifying a full path for the SaveCopyAs()? If not it might be
saving in an unexpected path. The working folder for the application may be
different when running your code as a dll. Try searching the disk for the
expected file name.
2. Make sure the files aren't read only or you don't open them as read only.
3. Is this a typo? If not what happened to the 's'? Sometimes this can be
caused if you put '\' in a literal without escaping it. I.E.
"c:\\temp\\savedppt.ppt".
 
T

technoknight

Mike,

I am answering ur points:
1.) Yeah, I am specifying the fullpath for the SaveCopyAs(). When I run the
code in the debug mode I checked the value(using add watch) of the
FileLocation (variable) and it showed me full path "c:\temp\savedppt.ppt".
2.) Well I am not sure about this. But, if my program is able to create the
save the file at the new location without any problem then I guess it should
be able to do that easily when I implement the dll. So, I guess tihs cannot
be the problem too.
3.)Yeah it was a typo. I meant "c:\\temp\\savedppt.ppt".

Thanks
 
A

Austin Myers

How are you building the DLL? In Visual Basic? If so what references are
you using for PPT?


Austin Myers
MS PowerPoint MVP Team

PowerPoint Video and PowerPoint Sound Solutions www.pfcmedia.com
 
T

technoknight

Reference that I m using for PPT are :
1.) Microsoft PowerPoint 10 Object Library.
2.) Microsoft Office 10 Object Library.
 

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