diff --git a/Development-Helper.xlam b/Development-Helper.xlam index 0c6a844..fe53ef7 100644 Binary files a/Development-Helper.xlam and b/Development-Helper.xlam differ diff --git a/src/DevelopmentHelper.bas b/src/DevelopmentHelper.bas new file mode 100644 index 0000000..af14672 --- /dev/null +++ b/src/DevelopmentHelper.bas @@ -0,0 +1,32 @@ +Attribute VB_Name = "DevelopmentHelper" +Option Explicit + +Sub ExportVbaModules() + Dim j As Integer + Dim strSourcePath As String + Dim ext As String + Dim fileName As String + + strSourcePath = ActiveWorkbook.Path & "\src" + If Dir(strSourcePath, vbDirectory) = vbNullString Then MkDir strSourcePath + + For j = 1 To ActiveWorkbook.VBProject.VBComponents.Count + With ActiveWorkbook.VBProject.VBComponents(j) + If .CodeModule.CountOfLines > 0 Then + Select Case .Type + Case 100: ext = ".cls" + Case 1: ext = ".bas" + Case 2: ext = ".cls" + Case 3: ext = ".frm" + Case Else: ext = vbNullString + End Select + + If ext <> vbNullString Then + fileName = strSourcePath & "\" & .name & ext + If Dir(fileName, vbNormal) <> vbNullString Then Kill (fileName) + .Export (fileName) + End If + End If + End With + Next +End Sub