ªð¦^¦Cªí ¤W¤@¥DÃD µo©«

[µo°Ý] ¦p¦ó¥Îµ{¦¡¸Ñ¶}VBA«OÅ@¤§«á¥iª½±µ­×§ïµ{¦¡½X?

[µo°Ý] ¦p¦ó¥Îµ{¦¡¸Ñ¶}VBA«OÅ@¤§«á¥iª½±µ­×§ïµ{¦¡½X?

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

µo²{¬O¦]¬°¥´¶}Àɮפ§«á,¨S¦³ÂI¶}¹Lµ{¦¡½Xªº¦a¤è,³£µLªkŪ¨ú¸Ó¼Ò²Õ
¦³¿ìªk¸Ñ¨M¶Ü?
PKKO

TOP

¦^´_ 2# PKKO

³o2­ÓÀɮ׳£¬O¦b³o¸Ì§ìªº¡A§A¨Ï¥Î¬Ý¬Ý¡C
Excel VBA ±K½X¯}¸Ñ¤è¦¡.rar (23.98 KB)

TOP

¦^´_ 3# jeffrey628litw


    ±z¦n,ÁÂÁ±zªº¦^ÂÐ
¦ý¨ä¹ê§Ú¨S¦³­n¯}¸ÑVBA±K½X
§Ú¤w¸gª¾¹DVBA±K½X

¬O§Æ±æµ{¦¡¯à°÷
¤@,¦Û°Ê¸Ñ¶}VBA±K½X
¤G¡B¥i³z¹Lµ{¦¡½X­×§ïµ{¦¡½X
PKKO

TOP

        ÀR«ä¦Û¦b : ¦a¤WºØ¤Fµæ¡A´N¤£©öªø¯ó¡F¤ß¤¤¦³µ½¡A´N¤£©ö¥Í´c¡C
ªð¦^¦Cªí ¤W¤@¥DÃD