This shows a quick workflow I use to handle VBA Macros so that they are diffed properly in a GIT/SVN repository.
Option Explicit Sub SaveCodeModules() 'This code Exports all VBA modules Dim i As Integer Dim sName As String With ThisWorkbook.VBProject For i% = 1 To .VBComponents.Count sName = .VBComponents(i).CodeModule.Name .VBComponents(i).Export ThisWorkbook.Path & "\" & sName$ & ".vb" Next i End With End Sub