Filed under: Excel VBA 範例, 一般程序

Pcces 工作表密碼解鎖

by chijanzen on 八月 22nd, 2009 | View: 3,893 views

Tags
  • No Tags
Share Comments (0)
索   引 H0075
主   題 Pcces 工作表密碼解鎖
版   本 >= 11.0(Office 2003)
說   明 工作上經常接觸標案,電子領標下來的excel檔幾乎都會加設密碼,每次下載來的檔案都要做解除密碼的動作還真是麻煩,於是寫了這個小工具來用。

其實Pcces轉出的excel檔案密碼都是一樣的 "RATSWVNXYRCMPIZ",不用這個小工具一樣可以自以手動解除密碼。這個工具只專門用來解Pcces檔案的,其他的密碼一概不能解,要解其他工作表密碼的可以參考 移除Excel工作簿及工作表密碼

參   考


複製以下程式碼到ThisWorkbook

Code

Private Sub Workbook_BeforeClose(Cancel As Boolean)
    On Error Resume Next
    Application.CommandBars("Standard").Controls("cmd_PCCES").Delete
    Application.CommandBars("Standard").Controls("cmd_SCTC").Delete
End Sub
 


Private Sub Workbook_Open()
    On Error Resume Next
    Dim TCSCButton As CommandBarButton
    Application.CommandBars("Standard").Controls("cmd_PCCES").Delete
    Set Std_Bar = Application.CommandBars("Standard")
    Set PCCE_Button = Std_Bar.Controls.Add(Type:=msoControlButton, Temporary:=True)
    With PCCE_Button
        .Caption = "cmd_PCCES"
        .OnAction = "xls_UnPcces"
        ThisWorkbook.Sheets("Sheet1").Shapes("PCCES").Copy
        .PasteFace
        .Style = msoButtonIcon
        .TooltipText = "Pcces 解鎖"
    End With
End Sub
 

複製以下程式碼到Module

Code

Sub xls_UnPcces()
    Dim sht As Worksheet
    For Each sht In Worksheets
        If sht.ProtectContents Then
        On Error Resume Next
            sht.Unprotect ("RATSWVNXYRCMPIZ")
        End If
    Next
    MsgBox "Pcces 工作表保護已解除"
End Sub

File download

Code

  這次沒做安裝程式,請直接開啟檔案然後在工具列點選解鎖的小圖示

  先開啟Pcces轉出的excel檔,然後再按解鎖的小圖示執行解鎖

File download

Code

檔案下載

Popularity: 44%

About the Author
    網路化名: chijanzen、中國龍、邪兵衛 經歷: 第二屆微軟社群之星 第三屆微軟「最有價值專家」 第五屆微軟「最有價值專家」
No comments currently exist for this post.

Why don't you make one?

Get a GravatarLeave a Reply

Name: « Required

Email Address: « Required

Website URL: « Optional

You can use these tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

About me
chijanzen 分享個人Excel VBA 學習經驗,架站心得, 日常生活記事等...

Add to Google

分類
Translator
Chinese (Simplified) flagItalian flagKorean flagEnglish flagGerman flag
French flagJapanese flagRussian flagBulgarian flagFinnish flag
相簿