¡@¼ÊºÙ: ªü¦N ¡@ÀY»Î: ¤£®¢¤U°Ý,¤£Â_¾Ç²ß,¤~·|¶i¨B
ª©¥D
- ©«¤l
- 647
- ¥DÃD
- 190
- ºëµØ
- 24
- ¿n¤À
- 1037
- ÂI¦W
- 0
- §@·~¨t²Î
- windows7
- ³nÅ骩¥»
- Office 2010 ; OOO3.0 ; Google
- ¾\ŪÅv
- 100
- ©Ê§O
- ¨k
- ¨Ó¦Û
- ¦Ë«n
- µù¥U®É¶¡
- 2010-5-2
- ³Ì«áµn¿ý
- 2022-6-24
|
[Âà¶K] ¦p¦ó§PÂ_¤@ÓÀɮפº¬O§_¥]§t§»
¥»©«³Ì«á¥Ñ HUNGCHILIN ©ó 2012-1-11 21:39 ½s¿è
³o¤@½g¬O¤@Ó«Ü«nªº¤å³¹
·í¦³¯à¤O¡A¬ð¯}¥¨¶°¦w¥þ©Ê®É¡A§ÚÌ¥ý§âEXCEL VBP §@¦¨"±M®×¤£¥iÀ˵ø"
·í¦³¤H¯}¸Ñ VBP "±M®×¤£¥iÀ˵ø"®É¡A¶}±Ò®ÉÀÉ®×¥ý§PÂ_vbe¬O§_«OÅ@¡A¦pªG³Q¯}¸Ñ¶}¡A´N§R°£¦Û¤v©Î¼Ò²Õ
¦p¦ó§PÂ_¤@ÓÀɮפº¬O§_¥]§t§»
Sub Check_VBA_Exist()
Dim fd As FileDialog
Dim FFs As FileDialogFilters
Dim stFileName As String
Dim vaItem
Dim VBC As Object
Dim HasCode As Boolean
Dim wb As Workbook
Set fd = Application.FileDialog(msoFileDialogOpen)
With fd
Set FFs = .Filters
With FFs
.Clear
.Add "Excel¤å¥ó", "*.xls;*.xla"
End With
.AllowMultiSelect = True
If .Show = -1 Then
For Each vaItem In .SelectedItems
Application.EnableEvents = False
Application.ScreenUpdating = False
Set wb = Workbooks.Open(vaItem)
HasCode = False
' 当档®×¦³¤uµ{±K码¬O,¥X错 , amended on 30 Jul 2006
If wb.VBProject.Protection = 1 Then ' §PÂ_vbe¬O§_«OÅ@
MsgBox "ÀÉ®×" & Dir(vaItem) & " VBA ±M®×³QÂê©w"
wb.Close 0
' Exit Sub
' End If
Else
For Each VBC In wb.VBProject.VBComponents
If VBC.Type <> 100 Then
HasCode = True: Exit For
ElseIf VBC.CodeModule.CountOfDeclarationLines < VBC.CodeModule.CountOfLines Then
HasCode = True: Exit For
End If
Next
If HasCode = True Then
MsgBox "ÀÉ®×" & Dir(vaItem) & " ¦³§»"
Else
MsgBox "ÀÉ®×" & Dir(vaItem) & " µL§»"
End If
wb.Close 0
Application.EnableEvents = True
Application.ScreenUpdating = True
End If
Next vaItem
End If
End With
End Sub
Ref: http://www.officefans.net/cdb/vi ... &extra=page%3D1 |
|