none
How can I display Excel using Word VSTO Addin. RRS feed

  • Question

  • Hi all.

    .

    I am a beginner.

    .

    And studying Word VSTO ribbon addins.

    .

    I wrote very simple one (works charm );   

    .

    Microsoft.Office.Interop.Word.Application  oAPP  =  Globals.ThisAddIn.Application;
    oAPP.Selection.InsertAfter( " Hello, Word !! " );        
    oAPP.Selection.Collapse();
    .

    Now, I have to go on.

    .

    I want to display "Hello, Excel !! " from the same addin (from the Word Addin)

    .

    I tried to port the following VBA codes (into Word Addin);

    .

        Set oEXCEL = CreateObject("Excel.Application")
        Set oWBOOK = oEXCEL.Workbooks.Add
        oWBOOK.ActiveSheet.Range("A1").Value = " Hello, Excel !! "
        oEXCEL.Visible = True

    .

    I do not know how to start from the very beginning.

    .

    I can not make "Application (for excel)" object at all.

    .

    VS says, the "Application" is not for the Excel but for the Word.

    .

    Yes, everybody know it. But, Excel has the same one too. So I tried to make casting. It never works.

    .

    I added required reference(s).

    .

    Wht do I have to do ?

    .

    Is it impossible, naturally ?

    .

    Regards





    Monday, February 9, 2015 6:51 AM

Answers

  • Dear, Eugene Astafiev

    .

    First of all,

    thanks for your prompt reply.

    .

    I just found that I lost/forgot a reference for Excel.

    I made a proper reference. And it works nicely.

    .

    Regards




    Monday, February 9, 2015 1:12 PM

All replies