override the saveas function in powerpoint

G

Guest

Hei.

I'm programming an addin using c#. My applications overrides the users
actions to save a presentation. I add some information and needs to save the
presentation myself. In word and excel there is a method called
document/workbook saveas.

I cant get the method for saving a presentation to work...

theActivePpt.SaveAs(filename,
Microsoft.Office.Interop.PowerPoint.PpSaveAsFileType.ppSaveAsPresentation,
Microsoft.Office.Core.MsoTriState.msoTriStateMixed);

I have tried serveral versions of the variables above.

I really hope someone knows how this can be solved :)
 
S

Steve Rindsberg

Hei.

I'm programming an addin using c#. My applications overrides the users
actions to save a presentation. I add some information and needs to save the
presentation myself. In word and excel there is a method called
document/workbook saveas.

I cant get the method for saving a presentation to work...

theActivePpt.SaveAs(filename,
Microsoft.Office.Interop.PowerPoint.PpSaveAsFileType.ppSaveAsPresentation,
Microsoft.Office.Core.MsoTriState.msoTriStateMixed);

I have tried serveral versions of the variables above.

I really hope someone knows how this can be solved :)

First we need to know what "this" is. You say you can't get it to work but
what does that mean? You get error messages? Crashes? Smoke out of the back
of the computer? :)

But for starters, have you just tried theActivePpt.Save
 
G

Guest

I get an exception when the saveAs method written earlier is called:
- the exception is a system.runtime.interopServices.COMException
- the error code is: -2147467259
- the message is Presentation(unknown member): Failed.

I tried your suggestion (theActivePpt.Save) - then I got an exception as
well :(

Neoret
 
S

Steve Rindsberg

I get an exception when the saveAs method written earlier is called:
- the exception is a system.runtime.interopServices.COMException
- the error code is: -2147467259
- the message is Presentation(unknown member): Failed.

I tried your suggestion (theActivePpt.Save) - then I got an exception as
well :(

FWIW, this in VBA works fine:

Sub TestSave()
ActivePresentation.SaveAs ("q:\support\junk.ppt")
End Sub

and would work equally well as:

oPresentationObject.SaveAs ....

Could it be that theActivePpt holds a reference to something other than a
Presentation object?
 
G

Guest

Thanks for helping me getting closer to success!

Could this have anything to do with late bounding?

I found out in debugging that when I run this method from word the
applicationobject = Microsoft.office.interop.word.applicationClass.

When I run it in powerpoint the applicationobject = System_Comobject...

This is probably the problem - but do you know why this happens?
 
S

Steve Rindsberg

Thanks for helping me getting closer to success!

Could this have anything to do with late bounding?

It could, I suspect. Since I don't use C# or .Net I can't easily interpret the results
you're seeing, but if you were doing the same thing in VB/VBA you'd need to declare the
presentation object as a generic object rather than as a presentation.
 

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