Error by create PP Sheet by english/german Version

Unanswered Error by create PP Sheet by english/german Version

  • lundi 30 avril 2012 13:40
     
     

    Greetings,

    I develop in Visual Studio 2010 German with Visual Basic a MS-Project Add-In.

    Now I create a Powerpoint prenentation with this source code:

       Try
                Dim PPApp As Microsoft.Office.Interop.PowerPoint.Application
                Dim PPPres As Microsoft.Office.Interop.PowerPoint.Presentation
                Dim PPSlide As Microsoft.Office.Interop.PowerPoint.Slide


                PPApp = CreateObject("PowerPoint.Application")
                PPApp.Visible = Microsoft.Office.Core.MsoTriState.msoTrue
                PPPres = PPApp.Presentations.Add
                PPSlide = PPPres.Slides.Add(1, Microsoft.Office.Interop.PowerPoint.PpSlideLayout.ppLayoutBlank)


            Catch ex As Exception
                MsgBox(ex.Message)
            End Try

     

    In the one virtual machine (VM) is Windows 7 with Office 2010 and Project 2010 all 32bit in german, it works perfect.

    In the second VM with the same programs but in english Version and 64bit an error occurred:

    “Error HRESULT E_FAIL has been returned from a call to a COM component.”

    What could be wrong?

    Thank you!

       Michael

Toutes les réponses

  • lundi 30 avril 2012 13:51
     
     
    how do you compile your code? as anycpu? do you use official PIA assemblies or generated on your own?
  • lundi 30 avril 2012 14:07
     
     

    > how do you compile your code? as anycpu?

    Yes, as "Any CPU".

    > do you use official PIA assemblies or generated on your own?

    I use the official PIA.

    If I create an excel-Sheet, it works in german and in english enviroment.

    Only Powerpoint create an error.

  • mardi 1 mai 2012 07:46
    Modérateur
     
     

    Hi Michael

    Which line of code is triggering the error? Knowing that might give us a clue...


    Cindy Meister, VSTO/Word MVP

  • mardi 1 mai 2012 09:15
     
     

    Hi Cindy,

    this line of code triggered the error:

       PPPres = PPApp.Presentations.Add

    Ciao

       Michael

  • jeudi 3 mai 2012 21:00
     
     

    Hello,

    now I have installed Visual Studio in the english version in my english virtual machine, but the error occured still allways.

    But now I can debug my code.

    What can I do to find the cause of the error?

    Please help. It is the last bug befor I can rollout the Add-In.

    Thank you!

       Michael

  • samedi 5 mai 2012 13:17
    Modérateur
     
     

    Hallo Michael

    I don't work with Project, so I can't test your scenario, but here are a couple of thoughts

    1. Do you see the same problem if you create a small test add-in for another application (such as Word or Excel)? If not, how about if you create a new, test add-in for Project?

    2. I see you're using CreateObject to start the PowerPoint application. Do you see a different behavior if you use

      PPApp = New PowerPoint.Application()


    Cindy Meister, VSTO/Word MVP

  • dimanche 6 mai 2012 10:50
     
      A du code

    Hello Cindy!

    > 1. Do you see the same problem if you create a small test add-in for another application (such as Word or Excel)?

    Now, I have create a Word Add-In:

    Public Class ThisAddIn
    
        Private Sub ThisAddIn_Startup() Handles Me.Startup
    
            Dim PPApp As Microsoft.Office.Interop.PowerPoint.Application
            Dim PPPres As Microsoft.Office.Interop.PowerPoint.Presentation
            Dim PPSlide As Microsoft.Office.Interop.PowerPoint.Slide
    
            'PPApp = CreateObject("PowerPoint.Application")
            PPApp = New Microsoft.Office.Interop.PowerPoint.Application()
            PPApp.Visible = Microsoft.Office.Core.MsoTriState.msoTrue
            Try
                PPPres = PPApp.Presentations.Add
            Catch ex As Exception
                MsgBox(ex.Message)
            End Try
            PPSlide = PPPres.Slides.Add(1, Microsoft.Office.Interop.PowerPoint.PpSlideLayout.ppLayoutBlank)
        End Sub
    
        Private Sub ThisAddIn_Shutdown() Handles Me.Shutdown
    
        End Sub
    
    End Class

    But the same error occured: “Error HRESULT E_FAIL has been returned from a call to a COM component.”

    Additional in the Visual Studio application, in the "Immediate Window" followed line are printing:

    A first chance exception of type 'System.Deployment.Application.DeploymentException' occurred in System.Deployment.dll
    A first chance exception of type 'System.Runtime.InteropServices.COMException' occurred in WordAddIn1.DLL
    A first chance exception of type 'System.Deployment.Application.DeploymentException' occurred in System.Deployment.dll
    A first chance exception of type 'System.NullReferenceException' occurred in WordAddIn1.DLL
    A first chance exception of type 'System.Deployment.Application.DeploymentException' occurred in System.Deployment.dll
    A first chance exception of type 'System.Runtime.InteropServices.COMException' occurred in WordAddIn1.DLL
    A first chance exception of type 'System.NullReferenceException' occurred in WordAddIn1.DLL
    A first chance exception of type 'System.Deployment.Application.DeploymentException' occurred in System.Deployment.dll
    A first chance exception of type 'System.Runtime.InteropServices.COMException' occurred in WordAddIn1.DLL

    > 2. I see you're using CreateObject to start the PowerPoint application. Do you see a different behavior if you use:  PPApp = New PowerPoint.Application()

    No, the same error occured.

    Thank you for hints!

       Michael

  • mardi 8 mai 2012 14:45
    Modérateur
     
     

    Hi Michael,

    I tested the code and it works as expected. My software environment like:

    Windows 7 ENU SP1 x64 + VS 2010 SP1 ENU + Office 2010 RTM 32bit ENU

    Does installing VSTO language pack make a difference?  refer to: http://www.microsoft.com/en-us/download/details.aspx?id=3435

    When you run into this error again, you can enable error log by setting environment variable VSTO_LOGALERTS=1, refer to: http://msdn.microsoft.com/en-us/library/ms269003.aspx

    Please share the log on Skydrive if you need help to analyze it.

    best regards,


    Forrest Guo | MSDN Community Support | Feedback to manager

  • mardi 8 mai 2012 19:38
     
     

    Hi,

    I have set the enviroment variables

    VSTO_LOGALERTS = 1
    VSTO_SUPPRESSDISPLAYALERTS = 0

    but ther is no log-file create!

    What I am doing wrong?

    Thank you!

       Michael

  • mercredi 9 mai 2012 03:24
    Modérateur
     
     

    Hi Michael,

    I have a couple of questions need to be clarified:

    1. The log locates along with the addin assembly, is it there?
    2. Also, does the VSTO runtime language pack suitable help in this case?

    best  regards,


    Forrest Guo | MSDN Community Support | Feedback to manager

  • jeudi 10 mai 2012 14:41
     
     

    Hi,

    > The log locates along with the addin assembly, is it there?

    Sorry, but there is no log file. Also no log file in the temp folder.

    > Also, does the VSTO runtime language pack suitable help in this case?

    Also no! I have installed the language pack, but the error is the same.

    Regards

       Michael

  • jeudi 10 mai 2012 15:34
    Modérateur
     
     

    Hi Michael,

     

    Your question falls into the professional support category which requires a more in-depth level of support. Please visit the below link to see the various paid support options that are available to better meet your needs.

    http://support.microsoft.com/default.aspx?id=fh;en-us;offerprophone

    best regards,


    Forrest Guo | MSDN Community Support | Feedback to manager