Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/vbaDeveloper.xlam/Build.bas
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ Private Function hasCodeToExport(component As VBComponent) As Boolean
hasCodeToExport = True
If component.codeModule.CountOfLines <= 2 Then
Dim firstLine As String
firstLine = Trim(component.codeModule.lines(1, 1))
firstLine = Trim(component.codeModule.Lines(1, 1))
'Debug.Print firstLine
hasCodeToExport = Not (firstLine = "" Or firstLine = "Option Explicit")
End If
Expand All @@ -158,7 +158,7 @@ Private Sub exportLines(exportPath As String, component As VBComponent)
Dim fso As New Scripting.FileSystemObject
Dim outStream As TextStream
Set outStream = fso.CreateTextFile(fileName, True, False)
outStream.Write (component.codeModule.lines(1, component.codeModule.CountOfLines))
outStream.Write (component.codeModule.Lines(1, component.codeModule.CountOfLines))
outStream.Close
End Sub

Expand Down Expand Up @@ -218,18 +218,18 @@ Private Sub checkHowToImport(file As Object, includeClassFiles As Boolean)
Dim fileName As String
fileName = file.name
Dim componentName As String
componentName = left(fileName, InStr(fileName, ".") - 1)
componentName = Left(fileName, InStr(fileName, ".") - 1)
If componentName = "Build" Then
'"don't remove or import ourself
Exit Sub
End If

If Len(fileName) > 4 Then
Dim lastPart As String
lastPart = right(fileName, 4)
lastPart = Right(fileName, 4)
Select Case lastPart
Case ".cls" ' 10 == Len(".sheet.cls")
If Len(fileName) > 10 And right(fileName, 10) = ".sheet.cls" Then
If Len(fileName) > 10 And Right(fileName, 10) = ".sheet.cls" Then
'import lines into sheet: importLines vbaProjectToImport, file
sheetsToImport.Add componentName, file
Else
Expand Down Expand Up @@ -297,7 +297,7 @@ End Sub

Private Sub importLines(vbaProject As VBProject, file As Object)
Dim componentName As String
componentName = left(file.name, InStr(file.name, ".") - 1)
componentName = Left(file.name, InStr(file.name, ".") - 1)
Dim c As VBComponent
If Not componentExists(vbaProject, componentName) Then
' Create a sheet to import this code into. We cannot set the ws.codeName property which is read-only,
Expand Down
3 changes: 3 additions & 0 deletions src/vbaDeveloper.xlam/EventListener.cls
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ End Sub

Private Sub App_WorkbookAfterSave(ByVal wb As Workbook, ByVal success As Boolean)
On Error GoTo App_WorkbookAfterSave_Error
If AUTO_SAVE = "Yes" Then 'This is set manually in the 'Build' macro so that users can choose whether they want autosave enabled.

'Export all the modules for this work book if save was successful
If success Then
Expand All @@ -45,6 +46,8 @@ End Sub
Private Sub App_WorkbookOpen(ByVal wb As Workbook)
On Error GoTo App_WorkbookOpen_Error

If AUTO_SAVE = "Yes" Then 'This is set manually in the 'Build' macro so that users can choose whether they want autosave enabled.

'Import all the modules for this workbook
Dim importNow As Integer
importNow = MsgBox("Import the code for " & wb.name & " now?", vbYesNo, "EventListener Workbook open event")
Expand Down