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 ~

コメントを残す

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

To respond on your own website, enter the URL of your response which should contain a link to this post's permalink URL. Your response will then appear (possibly after moderation) on this page. Want to update or remove your response? Update or delete your post and re-enter your post's URL again. (Find out more about Webmentions.)