- Sub test()
- UnprotectVBProj "0988", ActiveWorkbook '¸Ñ¶}¤WÂê(¥u¯à¸Ñ¶}µLªk¥Î)
- MsgBox ThisWorkbook.VBProject.VBE.CodePanes.Count '¥u·|Ū¥X0(¥¿±`¤£¥i¯à¨S¦³¼Ò²Õ)
- '¥²¶·n¤À¬°¨âÓ«ö¶s,¥ý¸Ñ¶}¤~¥i¥H§ïµ{¦¡½X,¦³¿ìªk¤@Ó«ö¶sª½±µ¸Ñ¶}¤S§ïµ{¦¡½X¶Ü?
- End Sub
- Sub UnprotectVBProj(ByVal Pwd As String, wb As Workbook)
- Dim vbProj As Object
- Set vbProj = wb.VBProject
- If vbProj.Protection <> 1 Then Exit Sub ' already unprotected
- Set Application.VBE.ActiveVBProject = vbProj
- SendKeys Pwd & "~~"
- Application.VBE.CommandBars(1).FindControl(ID:=2578, recursive:=True).Execute
- End Sub
½Æ»s¥N½X |