versiones anteriores de Excel y Access (antes de 2003) apoyado fuente de VBA Código de control de versiones a través de un complemento. Lo he usado muy bien en Office 2000.
El soporte de Visual SourceSafe (VSS) para VBA era dropped with the release of Office 2003, pero el complemento que se envió con el Desarrollador de Office XP aparentemente works with Office 2003.
artículos
Microsoft Knowledge Base:
En su defecto se puede utilizar este código para extraer el código VBA (de here pero faltaba la limpiezas finales de objetos). Leer la página web para salvedades:
option explicit
Const vbext_ct_ClassModule = 2
Const vbext_ct_Document = 100
Const vbext_ct_MSForm = 3
Const vbext_ct_StdModule = 1
Main
Sub Main
Dim xl
Dim fs
Dim WBook
Dim VBComp
Dim Sfx
Dim ExportFolder
If Wscript.Arguments.Count <> 1 Then
MsgBox "As the only argument, give the FULL path to an XLS file to extract all the VBA from it."
Else
Set xl = CreateObject("Excel.Application")
Set fs = CreateObject("Scripting.FileSystemObject")
xl.Visible = true
Set WBook = xl.Workbooks.Open(Trim(wScript.Arguments(0)))
ExportFolder = WBook.Path & "\" & fs.GetBaseName(WBook.Name)
fs.CreateFolder(ExportFolder)
For Each VBComp In WBook.VBProject.VBComponents
Select Case VBComp.Type
Case vbext_ct_ClassModule, vbext_ct_Document
Sfx = ".cls"
Case vbext_ct_MSForm
Sfx = ".frm"
Case vbext_ct_StdModule
Sfx = ".bas"
Case Else
Sfx = ""
End Select
If Sfx <> "" Then
On Error Resume Next
Err.Clear
VBComp.Export ExportFolder & "\" & VBComp.Name & Sfx
If Err.Number <> 0 Then
MsgBox "Failed to export " & ExportFolder & "\" & VBComp.Name & Sfx
End If
On Error Goto 0
End If
Next
xl.Quit
Set fs = Nothing
Set xl = Nothing
End If
End Sub
funciona bien. La única adición que hice antes de personalizar esta rutina para mi necesidad es agregar las siguientes líneas de código antes y después de abrir. xl.EnableEvents = False WBook = xl.Workbooks.Open (Trim ("SomeFile.xlsm")) xl.EnableEvents = True – chaltahai