Protect保护工作表。Protect方法可以指定保护密码参数,该密码为一个区分大小写的字符串。如果省略本参数,不用密码就可以取消对该工作表的保护。如:Dim App As New MSExcel.ApplicationDim Wb As MSExcel.WorkBook = App.WorkBooks.Open("D:\Report.xls")Dim Ws As MSExcel.WorkSheet = Wb.WorkSheets("同期对比")Ws.Protect(Password:="hhh") '以密码保护Wb.SaveApp.Quit
http://www.foxtable.com/help/topics/2121.htm