How to protect Excel workbook using VBA?

前端 未结 3 830
名媛妹妹
名媛妹妹 2020-12-03 19:10

With a trigger like a check box I want to protect my work book. I tried Excel 2003:

thisworkbook.protect(\"password\",true,true)

thisworkbook.unprotect(\"pa         


        
3条回答
  •  青春惊慌失措
    2020-12-03 19:40

    To lock whole workbook from opening, Thisworkbook.password option can be used in VBA.

    If you want to Protect Worksheets, then you have to first Lock the cells with option Thisworkbook.sheets.cells.locked = True and then use the option Thisworkbook.sheets.protect password:="pwd".

    Primarily search for these keywords: Thisworkbook.password or Thisworkbook.Sheets.Cells.Locked

提交回复
热议问题