none
Hide excel in .net RRS feed

  • Question

  • i need to protect my workbook, basicly want to enable sql login to work in excel file. that is it.

    basicly not allowing use of it without login.

    and not allowing copying formula. and disabling save as.

    Sunday, September 28, 2014 12:48 PM

Answers

  • Hello,

    The Workbook class from the Excel object model provides the Protect method which protects a workbook so that it cannot be modified.

    Sunday, September 28, 2014 1:13 PM
  • Hi BeAwareAlien,

    For this requirement, you could create a document level add-in, then add a form (used to login).

    In the workbook startup method, show that form as dialog.

    To disable save as you could use the custom ribbon xml to achieve that.

    For office 2013 and 2010.

    <?xml version="1.0" encoding="UTF-8"?>
    <customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui" onLoad="Ribbon_Load">
      <backstage onShow="ShowBackStage">
        <tab idMso="TabSave" Visible="false">
        </tab>
       
      </backstage>
     </customUI>
    For older version of office.
    <?xml version="1.0" encoding="UTF-8"?>  
    <customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui" onLoad="Ribbon_Load">  
      <commands>  
        <command idMso="FileSaveAs" enabled="false" />  
      </commands>  
    </customUI>  
    

    # Is it possible to disable Word's Save or Print functions?

    http://social.msdn.microsoft.com/Forums/vstudio/en-US/9e880e5e-ca41-4fb3-b78b-01573b8048c2/is-it-possible-to-disable-words-save-or-print-functions?forum=vsto

    Best Regards

    Starain Chen


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Monday, September 29, 2014 9:01 AM
    Moderator

All replies

  • Hello,

    The Workbook class from the Excel object model provides the Protect method which protects a workbook so that it cannot be modified.

    Sunday, September 28, 2014 1:13 PM
  • Hi BeAwareAlien,

    For this requirement, you could create a document level add-in, then add a form (used to login).

    In the workbook startup method, show that form as dialog.

    To disable save as you could use the custom ribbon xml to achieve that.

    For office 2013 and 2010.

    <?xml version="1.0" encoding="UTF-8"?>
    <customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui" onLoad="Ribbon_Load">
      <backstage onShow="ShowBackStage">
        <tab idMso="TabSave" Visible="false">
        </tab>
       
      </backstage>
     </customUI>
    For older version of office.
    <?xml version="1.0" encoding="UTF-8"?>  
    <customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui" onLoad="Ribbon_Load">  
      <commands>  
        <command idMso="FileSaveAs" enabled="false" />  
      </commands>  
    </customUI>  
    

    # Is it possible to disable Word's Save or Print functions?

    http://social.msdn.microsoft.com/Forums/vstudio/en-US/9e880e5e-ca41-4fb3-b78b-01573b8048c2/is-it-possible-to-disable-words-save-or-print-functions?forum=vsto

    Best Regards

    Starain Chen


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Monday, September 29, 2014 9:01 AM
    Moderator