none
error opening embedded excel sheet in word

    Question

  • i have created an excel 2007 addin with vsto2005 se.

    everything works fine. but if i embed any excel sheet in word and try to open this sheet later from word by double click it is not possible.

    i get error messages like server application not loaded. or excel not installed. if i unload the vsto addin everything works fine. it looks like that there is a problem with the application events. if i delete all application events in the addin its working. but even if i use one application event even with no code in in it its not working.

     

    anyone have an idea? may be embedding scenarios are not working in vsto2005se. what about the 2008 version?

    are there any work arounds?

    Saturday, February 23, 2008 4:58 AM

All replies

  • Hi,

     

    I cannot reproduce your issue. Could you please post your codes and describe steps how to duplicate it?

     

     

    Thanks,
    Ji

     

    Tuesday, February 26, 2008 5:15 AM
  • Hello Ji,

     

    thanks for your reply.

     

    Used programs: Vista, Office2007, VSTO2005SE

     

    1. Create a new VSTO Project with office 2007 addin template.

    2. Put no code in it but enter any application event like this:

     

    public class ThisAddIn

        Private Sub ThisAddIn_Startup(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Startup
            ' Anfang des von VSTO generierten Codes

            Me.Application = CType(Microsoft.Office.Tools.Excel.ExcelLocale1033Proxy.Wrap(GetType(Excel.Application), Me.Application), Excel.Application)

            ' Ende des von VSTO generierten Codes

        End Sub

        Private Sub ThisAddIn_Shutdown(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Shutdown

        End Sub

      
        Private Sub Application_SheetCalculate(ByVal Sh As Object) Handles Application.SheetCalculate

        End Sub
    End Class

    3. Compile the addin and start excel with the addin loaded.

    4. Put any characters in a cell of an empty excel sheet and copy.

    5. Paste it to word as Microsoft Excel Workbook Object

    6. when Double-click on the embedded excel objet to open it I get the following error message in word:

    (translated from german)

      The Server Application, the source file or the element was not found. make sure that the application was correct installed and not deleted, shifted, renamed or disabled by a policy.

     

    7. double-click a 2. time: word crashed.

     

    If I try the same procedure with the addin unloaded everything works fine.

    If I make a real empty addin by deleting this in the above code (application event):

     

    Private Sub Application_SheetCalculate(ByVal Sh As Object) Handles Application.SheetCalculate

        End Sub

     

    and repeat everything also everthing works fine.

     

    So the problem is the use of any application event. any other code is working as far as i know.

     

    In between I have tested the same with VS2008 and have the same problem.

     

    regards

     

    peter

     

     

    Tuesday, February 26, 2008 8:58 AM
  •  pietvad wrote:

    4. Put any characters in a cell of an empty excel sheet and copy.

    5. Paste it to word as Microsoft Excel Workbook Object

    6. when Double-click on the embedded excel objet to open it I get the following error message in word:

    (translated from german)

      The Server Application, the source file or the element was not found. make sure that the application was correct installed and not deleted, shifted, renamed or disabled by a policy.

     

    7. double-click a 2. time: word crashed.

     

    Hi Peter,

     

    I did not catch the step 4 and 5 exactly.

    I tried the following:

     

    Potential Scenario 1:

    4. Put any characters in a cell of an empty excel sheet and copy the cell

    5. Create a new Excel Workbook Object, and paste the cell into that embedded excel sheet

     

    Potential Scenario 2:

    4. Put any characters in a cell of an empty excel sheet and save the Workbook into disk. Copy workbook from disk.

    5. Open Word, and press Ctrl+V to paste excel workbook from memory into Word document.

     

    But none of them can reproduce the issue. Could you please clarify about this. Am I missing something you are doing?

     

     

    Thanks,

    Ji

    Wednesday, February 27, 2008 6:53 AM
  • Hi Ji,

     

    It  looks that you can not reproduce that issue. I think you did everything correct.

     

    my scenario:

    4. I open a new standard excel template like it will be shipped with excel and put any data in the first sheet and copy it.

    I do not save the workbook or do anything else.

    5. Then I open a new standard word template like it will be shipped with word and paste it as a excel workbook object from the memory.

    The document will not be saved.

    That´s all. After this you can go on with item 6 in my last message.

     

    If I try your scenario 2 I have the same effect.

     

    In between I have tried it on several computers. Everywhere is the same effect.

     

    It is somehow strange because there is not really code in the addin. The only difference is any

    empty Application event line in the code.

    In the last message I mentioned this event line :

     

    Private Sub Application_SheetCalculate(ByVal Sh As Object) Handles Application.SheetCalculate

        End Sub

     

    But its the same with any other application event. And its only this that makes the problem.

    Any other programming seems to be ok.

     

    Now I have sp1 of office and sp1 of vista installed but that has no effect on that issue.

     

    I wonder why you can not reproduce it. Can it be that`s concerning the different language versions ?

    I really have no idea any more...

    Do you think it make sense to open an official case at the microsoft support in germany?

    Actual i have no contract for that.

     

    Thanks,

     

    Peter

     

    p.s. we use to have symantec antivirus software installed. i will check if this can be the reason.

     

     

     

    Wednesday, February 27, 2008 12:32 PM
  • Hi Ji,

    antivir software has no effect . I also try with the english version of office and with xp as operation system.

    can you confirm that you really can not reproduce that issue? Do you have any idea what can be the reason?

     

    Thanks, peter

    Thursday, February 28, 2008 9:30 PM
  • Hi Peter,

     

    I verify this again. I cannot reproduce this issue. My environment is Visual Studio 2008 and Vista, Office 2007. All are English version.

     

    Friday, February 29, 2008 3:55 AM
  • Hi Ji,

     

    in between I have developed the addin with VS2008 and let it run on another computer with a fresh installion of office.

    English version. If I try to embed an excel sheet in word i have the same effect like already described. Trying the same with power point everything works fine. So I can do what I want. Seems I have the same effect in word at all scenarios.

    Why you can not reproduce this effect in word? And why works everything fine when i embed the same sheet in powerpoint? Any idea ?  

     

    Thanks Peter

    Sunday, March 02, 2008 8:30 PM
  •  pietvad wrote:

    in between I have developed the addin with VS2008 and let it run on another computer with a fresh installion of office.

    English version. If I try to embed an excel sheet in word i have the same effect like already described. Trying the same with power point everything works fine. So I can do what I want. Seems I have the same effect in word at all scenarios.

    Why you can not reproduce this effect in word? And why works everything fine when i embed the same sheet in powerpoint? Any idea ?  

    It appears that Word, for some reason, is unable to communicate with Excel as an OLE Server. Difficult to say why this may be the case, but a couple of standard troubleshooting steps are:

     

    1. Start Windows in Safe mode, to see if the problem persists.

     

    2. Start Word in Safe mode (by holding down the Ctrl key), then see if the problem persists.

     

    This will at least give an idea where the block may be coming from...

    Monday, March 03, 2008 2:45 PM
  • I'm getting the same error - and I think I know how to direct you to reproduce it. I'm using Windows XP SP2 & Office 2007 SP1 - I'm not using any of the visual studios tools and none of the files have any code of any kind in them.

     

    1. Open an Excel spreadsheet, select some data and copy it. I've found that it can be generic - .xlsx or .xls format

    2. Open a new Word file

    a. use the "Paste Special" option

    b. select the 1st option - MS Office Excel Worksheet Object

    c. check the "Display as an icon" box and OK

    3. Close Excel - if Excel is open, even if the file is closed, it works fine, When it's closed, I get the error when clicking on the embedded file in word.

     

    Might it have a relationship to the issue some people have with not being able to open a spreadsheet by double clicking - they have to open Excel and then open the file?

     

    Hopefully this will allow someone to recreate the problem and help us find a solution

     

    Melissa

    Thursday, August 21, 2008 1:06 AM
  • Have a look at Excel OLE Embedding Errors if you have Managed Add-In Sinking Application Events in Excel
    It seems to describe and solve the problems you mentioned. From the summary of that article:

    If you build a managed component that loads into Excel's process space, and the managed code uses the PIA (or a custom IA using event delegates)  to sink events on the Application object, that Excel instance may encounter problems when used for OLE embedding.  The problems include:

    • Being unable to update object if it is edited twice (inplace activatted, edited, closed, then activated and edited again) between saves.
    • Failure to release lock on object storage, which may inhibit proper closing of the main document file or return an error.
    • Crash of Word when one of the above problems occur and user attempts to edit object again after the reported error.
    Regards,
    HtS
    Monday, October 13, 2008 12:26 PM