VBA取消工作表或工作薄或工程密碼保護

2022-08-26 10:54:07 字數 1280 閱讀 8151

sub 取消工作表保護()

dim sht as worksheet

for each sht in worksheets

sht.protect drawingobjects:=true, contents:=true, scenarios:=true _

, allowfiltering:=true, allowusingpivottables:=true

sht.protect drawingobjects:=false, contents:=true, scenarios:= _

false, allowfiltering:=true, allowusingpivottables:=true

sht.protect drawingobjects:=true, contents:=true, scenarios:= _

false, allowfiltering:=true, allowusingpivottables:=true

sht.protect drawingobjects:=false, contents:=true, scenarios:= _

true, allowfiltering:=true, allowusingpivottables:=true

sht.unprotect

next

msgbox "已破解"

end sub

sub 破解工作薄密碼()

dim sh as worksheet

activeworkbook.sheets.copy

for each sh in activeworkbook.sheets

sh.visible = true

next

end sub

dim st as string * 2

dim s20 as string * 1

'取得乙個0d0a十六進製制字串

get #1, cmgs - 2, st

'取得乙個20十六制字串

get #1, dpbo + 16, s20

'替換加密部份機碼

for i = cmgs to dpbo step 2

put #1, i, st

next

'加入不配對符號

if (dpbo - cmgs) mod 2 <> 0 then

put #1, dpbo + 1, s20

end if

msgbox "檔案解密成功......", 32, "提示"

close #1

end sub

vba校對統計不同工作薄(2)

option explicit sub find dim myworkbook as workbook dim ws as worksheet dim rg as range,rg2 as range dim rgfirst as range dim nlength as integer,i as ...

M 常用EXCEL工作薄函式和VBA函式

match lookup value,lookup array,match type match 函式語法具有下列引數引數 為操作 事件 方法 屬性 函式或過程提供資訊的值。match type 行為1 或省略 match 查詢小於或等於 lookup value 的最大值。lookup array...

獲取Excel工作薄中Sheet頁 工作表 名集合

region 獲取excel工作薄中sheet頁 工作表 名集合 02.03.獲取excel工作薄中sheet頁 工作表 名集合 04.05.excel檔名及路徑,eg c users jk desktop 匯入測試.xls 06.sheet頁名稱集合 07.private string getex...