none
Microsoft.office.Interop.PowerPoint throwing error RRS feed

  • Question

  • Is there any reference guide for error codes? It throws error on CreateVideo method.

    Error Message: {"Error HRESULT E_FAIL has been returned from a call to a COM component."}

    ErrorCode: -2147467259

    Assembly:"Microsoft.Office.Interop.PowerPoint.PresentationClass, Microsoft.Office.Interop.PowerPoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"

    Public Function ConvertPPTFileToVideo(ByVal filename As String)
            Try
                Dim app As New PowerPoint.Application()
                Dim oPresSet As PowerPoint.Presentations = app.Presentations
                Dim pres As PowerPoint.Presentation = oPresSet.Presentations.Open(filename, Microsoft.Office.Core.MsoTriState.msoTrue, Microsoft.Office.Core.MsoTriState.msoTrue, Microsoft.Office.Core.MsoTriState.msoFalse)
                Dim wmvfile = "C:\Video\" + filename.Split(".")(0) + ".wmv"

                pres.CreateVideo(wmvfile, False, 3, 700, 25, 100)
            Catch ex As Exception

            End Try
            Return filename.Split(".")(0) + ".wmv"
        End Function

    Friday, June 21, 2013 7:03 PM

Answers

  • Sometimes you can get better (more precise) information if you try to perform the problem action in VBA. That will generally return "better" error information than what filters back into the .NET interface. Better than what you're currently getting would be to use MessageBox.Show(ex.Message) in your Catch block. But the VBA route is usually better.


    Cindy Meister, VSTO/Word MVP, my blog

    Saturday, June 22, 2013 10:25 AM
    Moderator
  • Hi Queen Sparrow,

    Thank you for posting in the MSDN Forum.

    What do you mean by filename.Split(".")(0)?

    Dim wmvfile = "C:\Video\" + filename.Split(".")(0) + ".wmv"

    You can see the definition of String.Split Method from this page http://msdn.microsoft.com/en-us/library/system.string.split.aspx.

    You'll need to make sure the video file name is valid before you pass it to CreateVideo method.

    Also you can try Cindy's suggestion, run the code in VBA editor.

    Hope it helps.

    Best regards,


    Quist Zhang [MSFT]
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Monday, June 24, 2013 12:49 PM
    Moderator

All replies

  • Sometimes you can get better (more precise) information if you try to perform the problem action in VBA. That will generally return "better" error information than what filters back into the .NET interface. Better than what you're currently getting would be to use MessageBox.Show(ex.Message) in your Catch block. But the VBA route is usually better.


    Cindy Meister, VSTO/Word MVP, my blog

    Saturday, June 22, 2013 10:25 AM
    Moderator
  • Hi Queen Sparrow,

    Thank you for posting in the MSDN Forum.

    What do you mean by filename.Split(".")(0)?

    Dim wmvfile = "C:\Video\" + filename.Split(".")(0) + ".wmv"

    You can see the definition of String.Split Method from this page http://msdn.microsoft.com/en-us/library/system.string.split.aspx.

    You'll need to make sure the video file name is valid before you pass it to CreateVideo method.

    Also you can try Cindy's suggestion, run the code in VBA editor.

    Hope it helps.

    Best regards,


    Quist Zhang [MSFT]
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Monday, June 24, 2013 12:49 PM
    Moderator