ExcelのVBAでシートを一括保護する。あと画像貼り付けは許可する

ExcelのVBAでシートを一括保護するしておくVBA。
あと画像貼り付けは許可したい場合は
DrawingObjects:=False
で描画オブジェクトのロックを外しておく。

Sub alllock() '全シート一括保護
Dim W As Worksheet
For Each W In Worksheets
W.Protect Password:="passwd", DrawingObjects:=False
Next W
End Sub

Sub allrelease() '全シート一括保護解除
Dim W As Worksheet
For Each W In Worksheets
W.Unprotect Password:="passwd"
Next W
End Sub

その他設定値は以下参照
http://www.officepro.jp/excelvba/sheet_ope/index2.html

はじめてのVBA ~

コメントを残す

メールアドレスが公開されることはありません。 ※ が付いている欄は必須項目です

Your post must include a link to this post.

How does this work?
Write a response on your own website and include a link to this post. Then submit your response’s URL here. Your response may appear here after moderation. To update or remove it, edit or delete your original post and submit the same URL again. Learn more about Webmentions.