Public VBInstance As VBIDE.VBE
Public Connect As Connect
Option Explicit
Private Sub CancelButton_Click()
Connect.Hide
End Sub
Private Sub OKButton_Click()
CleanUpUnUsedReferences
End Sub
Private Function CleanUpUnUsedReferences()
Dim c, my, mn
'On Error GoTo ErrHandler
Dim ref As VBIDE.Reference
Dim refPath As String
For Each ref In VBInstance.ActiveVBProject.References
refPath = ref.FullPath
c = ref.Guid: my = ref.Major: mn = ref.Minor
If ref.BuiltIn <> True Then
With VBInstance.ActiveVBProject.References
.Remove ref 'hapus reference
' Shell "regsvr32.exe " & Chr(34) & refPath & Chr(34) & " /u /s"
VBInstance.ActiveVBProject.MakeCompiledFile 'compile, jika error kembalikan reference
End With
End If
Next
Exit Function
ErrHandler:
VBInstance.ActiveVBProject.References.AddFromGuid c, my, mn 'kembalikan reference
Err.Clear
Resume Next
End Function
Tuesday, June 12, 2012
Menghilangkan Reference DLL Yang Tidak Digunakan - VB6 Add-Ins
Labels:
Add-Ins-VB6