locked
How to View or Edit Excel having Macros and formulas in winform using c# RRS feed

  • Question

  • Hi All,

    I want to develop one win form application where user will be able to view and edit the excel having Macros and formulas written for the cells.Also the excel is having many controls like button and drop downs.Please suggest me the native control or any third party control can be used for this kind of requirement.

    • Moved by CoolDadTx Monday, February 13, 2017 3:43 PM Office related
    Monday, February 13, 2017 10:08 AM

All replies

  • Hello,

    Here is the best place to ask https://social.msdn.microsoft.com/Forums/office/en-US/home?forum=exceldev


    Please remember to mark the replies as answers if they help and unmark them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.
    VB Forums - moderator
    profile for Karen Payne on Stack Exchange, a network of free, community-driven Q&A sites

    Monday, February 13, 2017 11:07 AM
  • Hi,

    Do you want open the workbook in winform and make its feature complete?

    I think you can use control:webbrowser.

    Add the control from Toolbox,you can create a button and then type the code in button click event.

    String tempFileName = @"C:\Users\Administrator\Desktop\Test.xlsm";
    webBrowser1.Navigate(tempFileName);

    However,the workbook maybe not open in the webbrowser and then you need to

    modify the registry with text below

     

    Windows Registry Editor Version 5.00 

      

    [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Word.Document.8] 

    "BrowserFlags"=dword:80000024 

      

    [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Word.RTF.8] 

    "BrowserFlags"=dword:80000024 

      

    [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Word.Document.12] 

    "BrowserFlags"=dword:80000024 

      

    [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Word.DocumentMacroEnabled.12] 

    "BrowserFlags"=dword:80000024 

      

    [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Excel.Sheet.8] 

    "BrowserFlags"=dword:80000A00 

      

    [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Excel.Sheet.12] 

    "BrowserFlags"=dword:80000A00 

      

    [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Excel.SheetMacroEnabled.12] 

    "BrowserFlags"=dword:80000A00 

      

    [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Excel.SheetBinaryMacroEnabled.12] 

    "BrowserFlags"=dword:80000A00 

      

    [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\PowerPoint.Show.8] 

    "BrowserFlags"=dword:800000A0 

      

    [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\PowerPoint.Show.12] 

    "BrowserFlags"=dword:800000A0 

      

    [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\PowerPoint.ShowMacroEnabled.12] 

    "BrowserFlags"=dword:800000A0 

      

    [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\PowerPoint.SlideShow.8] 

    "BrowserFlags"=dword:800000A0 

      

    [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\PowerPoint.SlideShow.12] 

    "BrowserFlags"=dword:800000A0 

      

    [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\PowerPoint.SlideShowMacroEnabled.12] 

    "BrowserFlags"=dword:800000A0 

     

    Hope that can help you
    • Edited by Terry Xu - MSFT Wednesday, February 15, 2017 3:19 AM
    • Proposed as answer by Chenchen Li Thursday, February 16, 2017 2:01 AM
    Wednesday, February 15, 2017 2:37 AM
  • Hi BhabaniNet,

    Check if the below sample helps:

    View and Edit Excel Spreadsheet in Windows Forms

    • Proposed as answer by Chenchen Li Thursday, February 16, 2017 2:00 AM
    Wednesday, February 15, 2017 9:19 AM