Added sourcecode

This commit is contained in:
magdev
2024-07-19 02:27:24 +02:00
parent c25d80da4c
commit ed712176c8
2 changed files with 32 additions and 0 deletions

Binary file not shown.

32
src/DevelopmentHelper.bas Normal file
View File

@@ -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