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

[¤À¨É] ¥t¦s·sÀɮɥh°£Àɮפ¤©Ò¦³µ{¦¡½X

[¤À¨É] ¥t¦s·sÀɮɥh°£Àɮפ¤©Ò¦³µ{¦¡½X

Option Explicit
Sub CleanVBComponents()
    Dim objVBC As Object
    Dim objMdl As Object
    Dim arr() As Variant
    Dim intCounter As Integer
    Dim txt As String
    Dim fileSaveName As Variant
    Dim Msg As String
    Dim ctl As Shape

    Msg = "¥t¦sÀÉ®×"
    ChDir ThisWorkbook.Path

    fileSaveName = Application.GetSaveAsFilename( _
            FileFilter:="Excel Files (*.xls), *.xls", Title:=Msg)

    If fileSaveName = False Then Exit Sub
    Application.ScreenUpdating = False

    For Each ctl In Sheet1.Shapes
        ctl.Delete
    Next ctl

    ReDim arr(1 To 3, 1 To ActiveWorkbook.VBProject.VBComponents.Count)
    intCounter = 0
    Application.StatusBar = "§R°£VBEµ{¦¡½X..."
    For Each objVBC In ActiveWorkbook.VBProject.VBComponents
        Set objMdl = objVBC.CodeModule
        intCounter = intCounter + 1

        arr(1, intCounter) = objVBC.Type

        arr(2, intCounter) = objVBC.Name
        If objMdl.countoflines > 0 Then
            txt = objVBC.CodeModule.Lines(1, objMdl.countoflines)
        End If
        arr(3, intCounter) = txt
        Select Case arr(1, intCounter)
            Case 1
                ActiveWorkbook.VBProject.VBComponents.Remove objVBC
            Case 2
                ActiveWorkbook.VBProject.VBComponents.Remove objVBC
            Case 100
                objVBC.CodeModule.DeleteLines 1, objMdl.countoflines
            Case 3
                ActiveWorkbook.VBProject.VBComponents.Remove objVBC
                DoEvents
        End Select
    Next objVBC
    ThisWorkbook.SaveAs fileSaveName
    Application.ScreenUpdating = True
    Application.StatusBar = ""
End Sub

½Ð°Ý¶{ª©¥D
³o¬q¤å³¹
°w¹ïªº¬O¥t¦s·sÀÉ®É
§R±¼¥þ³¡ªºµ{¦¡½X....
(¼Ò²Õ¥þ§R±¼¤£¬O¤]¥i¥H?)
¥t¥~¦pªG¥u­n§R¤@¥b¨º¤£´N­n­«¼g?
ÁÂÁÂ!!

TOP

¬O¥t¦s·sÀÉ®É ±N·sÀɧR°£!
¥ç¥i§ï¬° °ßŪ ¨Ã±N­ìÀɧR°£...
¦pªGdebug¹Lµ{¤¤»~§R°£ ¨þ¨þ¨þ~ ¨º½Ð¸`«s...

TOP

¬O¥t¦s·sÀÉ®É ±N·sÀɧR°£!
¥ç¥i§ï¬° °ßŪ ¨Ã±N­ìÀɧR°£...
¦pªGdebug¹Lµ{¤¤»~§R°£ ¨þ¨þ¨þ~ ¨º½Ð¸`«s...
Min µoªí©ó 2010-5-10 09:45


¶{ªO¥D
±z«ÕÀq¤F
¦pªGdebug¹Lµ{¤¤»~§R°£ ¨þ¨þ¨þ~ ¨º½Ð¸`«s...

­n§RÀÉ«e(©Î¥t¦s·sÀÉ«e)
¥ý³Æ¥÷ÂÂÀÉ.......(¸`«s¨S¥Îªº....¯«¥PÃø±Ï!!)
ÁÂÁÂ!!

TOP

¦^´_ 1# Min


    ¤§«e§Ú³£¬O¤â°Ê§R°£
   ³o­Óµ{¦¡½X§Ú¦³¥Î¨ì
   ¤£¹L§ÚÁÙ¬O¬ã¨s¨Ì¤U
   ÁÂÁ¤À¨É
¦r¨å¨â¦U¦r ÁÙ¯uÃø²z¸Ñ

TOP

¦^´_ 1# Min
³o­Ó¦³¥Î, ¥[¶i¤å¥ó¨Ó¸Õ¸Õ®ÄªG

TOP

§Ú³£¬O°õ¦æ§¹²¦«á, ¦A¤â°Ê§R°£¥¨¶°½X, ³o¬q¥i¥H¦n¦nªº¬ã¨s¤@½, Thanks
Homeman

TOP

¦^´_ 1# Min


¤W­zµ{¦¡¸Õ¹L¡A¥t¦s¤@­ÓµL¢þ¢ê¢éµ{¦¡½X¡A²£¥Í­ì©lÀÉ¡]¦³¢þ¢ê¢é½X¡^¡B¥t¦s·sÀÉ¡]µL¢þ¢ê¢é½X¡^¦@¦s   
·Q½Ð°Ý­n¦p¦ó¶È¯d¦s¡e¥t¦s·sÀÉÀɮס]µL¢þ¢ê¢é½X¡^¡f¡A¥t±N­ì©lÀɧR±¼¡A¨Ã¦b©U§£±í¤]§ä¤£¨ì¡A³o­n¦p¦ó¼g©O¡H¡H

TOP

¦^´_ 8# sillykin


    ¤W­z¤§µ{¦¡½X¬°VBAProject¥¼³]©w±K½X®É¥i¨Ï¥Î
¤@¦ý³]©w±K½X®É,´NµLªk¨Ï¥Î¡A¥i§_¦b¤W­zµ{¦¡½X¤¤¥[¤JVBAProject±K½X¡A¬O§_¥i¦æ©O¡H¡H¡H

TOP

·PÁÂ,¦³À°§U+1
PKKO

TOP

        ÀR«ä¦Û¦b : ¤Ó¶§¥ú¤j¡B¤÷¥À®¦¤j¡B§g¤l¶q¤j¡A¤p¤H®ð¤j¡C
ªð¦^¦Cªí ¤W¤@¥DÃD