locked
Excel Create new Instance. RRS feed

  • Question

  • Hi Everyone,

    I need help following problem

    I am using excel Addin (Office 2013)I am trying to do the read excel from the resource of project(e.g AccountTally.Properties.Resources.Account)) and want write this excel to the currently open excel by user.
    Below is the code which i am using to do this.


     string filePath = Path.Combine(Path.GetTempPath(), "Account.xlsm"); 
     File.WriteAllBytes(filePath, AccountTally.Properties.Resources.Account);
    _WorkBook = Globals.ThisAddIn.Application.Workbooks.Open(filePath, Type.Missing, Type.Missing, Type.Missing, Type.Missing,
                            Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing);
                        
    _WorkBooks = _WorkBook;


    Above Code is write the my excel from resources to the new excel but not the excel opened by user. This code was working 
    fine with office 2010.


    More information
    scenario is as follows.
    User open excel(Say Book1)
      >> He find the Tab Account 
         >> he click the tab and the he will login
            >> here i want to show the excel from my resources in Book1 but Book1 not get modified and it open new instance
      of excel by name account.xlsm, which i dont want.it must get open in Book1 and Book1 Look like Account.xlsm

    Account.xlsm contain some table where i am showing data from Sql it works file with office excel 2013.
    Wednesday, March 6, 2013 2:07 PM