Skip to content

Commit 53b9690

Browse files
committed
Revert "temp2"
This reverts commit 0ed879b.
1 parent 0ed879b commit 53b9690

File tree

11 files changed

+1751
-1751
lines changed

11 files changed

+1751
-1751
lines changed

src/vbaDeveloper.xlam/Build.bas

Lines changed: 415 additions & 415 deletions
Large diffs are not rendered by default.
Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
1-
VERSION 1.0 CLASS
2-
BEGIN
3-
MultiUse = -1 'True
4-
END
5-
Attribute VB_Name = "CustomActions"
6-
Attribute VB_GlobalNameSpace = False
7-
Attribute VB_Creatable = False
8-
Attribute VB_PredeclaredId = False
9-
Attribute VB_Exposed = True
10-
Option Explicit
11-
12-
' Interface with hooks for thisWorkbook open and close actions
13-
'
14-
' An implementation can for example open a number of workbooks, connect to a database, load data and initialize worksheets,
15-
' or any other tasks that otherwise have to be done manually.
16-
17-
'Called after thisWorkbook is opened
18-
Sub afterOpen()
19-
End Sub
20-
21-
'Called before thisWorkbook is closed
22-
Sub beforeClose()
23-
End Sub
24-
1+
VERSION 1.0 CLASS
2+
BEGIN
3+
MultiUse = -1 'True
4+
END
5+
Attribute VB_Name = "CustomActions"
6+
Attribute VB_GlobalNameSpace = False
7+
Attribute VB_Creatable = False
8+
Attribute VB_PredeclaredId = False
9+
Attribute VB_Exposed = True
10+
Option Explicit
11+
12+
' Interface with hooks for thisWorkbook open and close actions
13+
'
14+
' An implementation can for example open a number of workbooks, connect to a database, load data and initialize worksheets,
15+
' or any other tasks that otherwise have to be done manually.
16+
17+
'Called after thisWorkbook is opened
18+
Sub afterOpen()
19+
End Sub
20+
21+
'Called before thisWorkbook is closed
22+
Sub beforeClose()
23+
End Sub
24+
Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
1-
Attribute VB_Name = "ErrorHandling"
2-
Option Explicit
3-
4-
Public Sub RaiseError(errNumber As Integer, Optional errSource As String = "", Optional errDescription As String = "")
5-
If errSource = "" Then
6-
'set default values
7-
errSource = Err.Source
8-
errDescription = Err.Description
9-
End If
10-
Err.Raise vbObjectError + errNumber, errSource, errDescription
11-
End Sub
12-
13-
14-
Public Sub handleError(Optional errLocation As String = "")
15-
Dim errorMessage As String
16-
errorMessage = "Error in " & errLocation & ", [" & Err.Source & "] : error number " & Err.Number & vbNewLine & Err.Description
17-
Debug.Print errorMessage
18-
MsgBox errorMessage, vbCritical, "vbaDeveloper ErrorHandler"
19-
End Sub
20-
1+
Attribute VB_Name = "ErrorHandling"
2+
Option Explicit
3+
4+
Public Sub RaiseError(errNumber As Integer, Optional errSource As String = "", Optional errDescription As String = "")
5+
If errSource = "" Then
6+
'set default values
7+
errSource = Err.Source
8+
errDescription = Err.Description
9+
End If
10+
Err.Raise vbObjectError + errNumber, errSource, errDescription
11+
End Sub
12+
13+
14+
Public Sub handleError(Optional errLocation As String = "")
15+
Dim errorMessage As String
16+
errorMessage = "Error in " & errLocation & ", [" & Err.Source & "] : error number " & Err.Number & vbNewLine & Err.Description
17+
Debug.Print errorMessage
18+
MsgBox errorMessage, vbCritical, "vbaDeveloper ErrorHandler"
19+
End Sub
20+
Lines changed: 70 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -1,70 +1,70 @@
1-
VERSION 1.0 CLASS
2-
BEGIN
3-
MultiUse = -1 'True
4-
END
5-
Attribute VB_Name = "EventListener"
6-
Attribute VB_GlobalNameSpace = False
7-
Attribute VB_Creatable = False
8-
Attribute VB_PredeclaredId = False
9-
Attribute VB_Exposed = False
10-
Option Explicit
11-
12-
'This class receives and acts upon events from the excel application.
13-
' To disable this eventhandling, simply don't instantiate this class. See Thisworkbook.
14-
15-
16-
Private WithEvents App As Application
17-
Attribute App.VB_VarHelpID = -1
18-
19-
20-
Private Sub Class_Initialize()
21-
Set App = Application
22-
End Sub
23-
24-
25-
Private Sub App_WorkbookAfterSave(ByVal wb As Workbook, ByVal success As Boolean)
26-
On Error GoTo App_WorkbookAfterSave_Error
27-
28-
'Export all the modules for this work book if save was successful
29-
If success Then
30-
Build.exportVbaCode wb.VBProject
31-
NamedRanges.exportNamedRanges wb
32-
MsgBox "Finished saving workbook: " & wb.name & " . Code is exported."
33-
Else
34-
MsgBox "Saving workbook: " & wb.name & " was not successful. Code is not exported."
35-
End If
36-
37-
Exit Sub
38-
App_WorkbookAfterSave_Error:
39-
ErrorHandling.handleError "vbaDeveloper.EventListener afterSave"
40-
End Sub
41-
42-
43-
Private Sub App_WorkbookBeforeSave(ByVal wb As Workbook, ByVal SaveAsUI As Boolean, Cancel As Boolean)
44-
If Not Cancel Then
45-
Formatter.formatProject wb.VBProject
46-
End If
47-
End Sub
48-
49-
50-
Private Sub App_WorkbookOpen(ByVal wb As Workbook)
51-
On Error GoTo App_WorkbookOpen_Error
52-
53-
'Import all the modules for this workbook
54-
Dim importNow As Integer
55-
importNow = MsgBox("Import the code for " & wb.name & " now?", vbYesNo, "EventListener Workbook open event")
56-
If importNow = vbYes Then
57-
Build.importVbaCode wb.VBProject
58-
NamedRanges.importNamedRanges wb
59-
End If
60-
61-
Exit Sub
62-
App_WorkbookOpen_Error:
63-
ErrorHandling.handleError "vbaDeveloper.EventListener WorkbookOpen"
64-
End Sub
65-
66-
67-
Private Sub Class_Terminate()
68-
Set App = Nothing
69-
End Sub
70-
1+
VERSION 1.0 CLASS
2+
BEGIN
3+
MultiUse = -1 'True
4+
END
5+
Attribute VB_Name = "EventListener"
6+
Attribute VB_GlobalNameSpace = False
7+
Attribute VB_Creatable = False
8+
Attribute VB_PredeclaredId = False
9+
Attribute VB_Exposed = False
10+
Option Explicit
11+
12+
'This class receives and acts upon events from the excel application.
13+
' To disable this eventhandling, simply don't instantiate this class. See Thisworkbook.
14+
15+
16+
Private WithEvents App As Application
17+
Attribute App.VB_VarHelpID = -1
18+
19+
20+
Private Sub Class_Initialize()
21+
Set App = Application
22+
End Sub
23+
24+
25+
Private Sub App_WorkbookAfterSave(ByVal wb As Workbook, ByVal success As Boolean)
26+
On Error GoTo App_WorkbookAfterSave_Error
27+
28+
'Export all the modules for this work book if save was successful
29+
If success Then
30+
Build.exportVbaCode wb.VBProject
31+
NamedRanges.exportNamedRanges wb
32+
MsgBox "Finished saving workbook: " & wb.name & " . Code is exported."
33+
Else
34+
MsgBox "Saving workbook: " & wb.name & " was not successful. Code is not exported."
35+
End If
36+
37+
Exit Sub
38+
App_WorkbookAfterSave_Error:
39+
ErrorHandling.handleError "vbaDeveloper.EventListener afterSave"
40+
End Sub
41+
42+
43+
Private Sub App_WorkbookBeforeSave(ByVal wb As Workbook, ByVal SaveAsUI As Boolean, Cancel As Boolean)
44+
If Not Cancel Then
45+
Formatter.formatProject wb.VBProject
46+
End If
47+
End Sub
48+
49+
50+
Private Sub App_WorkbookOpen(ByVal wb As Workbook)
51+
On Error GoTo App_WorkbookOpen_Error
52+
53+
'Import all the modules for this workbook
54+
Dim importNow As Integer
55+
importNow = MsgBox("Import the code for " & wb.name & " now?", vbYesNo, "EventListener Workbook open event")
56+
If importNow = vbYes Then
57+
Build.importVbaCode wb.VBProject
58+
NamedRanges.importNamedRanges wb
59+
End If
60+
61+
Exit Sub
62+
App_WorkbookOpen_Error:
63+
ErrorHandling.handleError "vbaDeveloper.EventListener WorkbookOpen"
64+
End Sub
65+
66+
67+
Private Sub Class_Terminate()
68+
Set App = Nothing
69+
End Sub
70+

0 commit comments

Comments
 (0)