如何在vb.net中锁定或保护vba文件 [英] how to lock or protected vba file in vb.net

查看:117
本文介绍了如何在vb.net中锁定或保护vba文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的朋友



如何在vb.net或vb6.0中通过代码保护excel工作簿。

excel工作簿不是excel表

谢谢...

解决方案

如果您希望保护工作簿不被打开和/或只读,那么在另存为对话框,单击保存按钮左侧的工具下拉菜单,并指定打开/允许修改的密码。



这可以通过VBA实现如下所示:



  ActiveWorkbook  SaveAs 文件名:=C:\Users\John  Mc  Hale \Documents\Protect.xls _  
,FileFormat:= xlExcel8,密码:=密码,WriteResPassword:= _
password,ReadOnlyRecommended:= False,Create备份:=假


Dear friends

how to protect excel workbook in vb.net or vb6.0 thru code.
excel workbook not excel sheet
thanks...

解决方案

If you wish to protect the workbook from being opened and/or read-only then in the Save As dialog box, click the Tools drop-down to the left of the Save button and specify the password for opening/allowing modification.

This can be achieved in VBA using something like the following:

ActiveWorkbook.SaveAs Filename:="C:\Users\John Mc Hale\Documents\Protect.xls" _
        , FileFormat:=xlExcel8, Password:="password", WriteResPassword:= _
        "password", ReadOnlyRecommended:=False, CreateBackup:=False


这篇关于如何在vb.net中锁定或保护vba文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆