-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathThisWorkbook.cls
82 lines (62 loc) · 3.19 KB
/
ThisWorkbook.cls
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
VERSION 1.0 CLASS
BEGIN
MultiUse = -1 'True
END
Attribute VB_Name = "ThisWorkbook"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = True
' Excel 文檔打開時的操作
Private Sub Workbook_Open()
On Error Resume Next
''遍歷所有模塊,並移除不符合條件的已存在模塊
'Dim moduleName
'moduleName = Array("clsBrowser", "clsCore", "clsJsConverter", "DatabaseDispatchModule", "DatabaseControlPanel", "AlgorithmDispatchModule", "StatisticsAlgorithmControlPanel", "CrawlerDispatchModule", "CrawlerControlPanel")
'Dim i As Integer, j As Integer
'Dim flagBoolean As Boolean
'flagBoolean = True
'For i = 1 To ThisWorkbook.VBProject.VBComponents.Count
' flagBoolean = True
' For j = LBound(moduleName) To UBound(moduleName)
' If CStr(ThisWorkbook.VBProject.VBComponents(i).Name) = moduleName(j) Then
' flagBoolean = False
' Exit For
' End If
' Next j
' If (CStr(ThisWorkbook.VBProject.VBComponents(i).Name) = "ThisWorkbook") Then
' flagBoolean = False
' End If
' For j = 1 To ThisWorkbook.Worksheets.Count
' If CStr(ThisWorkbook.VBProject.VBComponents(i).Name) = CStr(ThisWorkbook.Worksheets(j).Name) Then
' flagBoolean = False
' Exit For
' End If
' Next j
' If flagBoolean Then
' 'Debug.Print ThisWorkbook.VBProject.VBComponents(i).Name
' ThisWorkbook.VBProject.VBComponents.Remove ThisWorkbook.VBProject.VBComponents(i): Rem 移除模塊
' End If
'Next i
'ThisWorkbook.Save
Call DatabaseDispatchModule.initial '調用鏈接操控數據庫調度模組的自定義子過程變量初始化賦初值
Call DatabaseDispatchModule.MenuSetup '調用鏈接操控數據庫調度模組的自定義子過程創建自定義菜單欄
Call AlgorithmDispatchModule.initial '調用統計計算方法調度模組的自定義子過程變量初始化賦初值
Call AlgorithmDispatchModule.MenuSetup '調用統計計算方法調度模組的自定義子過程創建自定義菜單欄
Call CrawlerDispatchModule.initial '調用網絡爬蟲調度模組的自定義子過程變量初始化賦初值
Call CrawlerDispatchModule.MenuSetup '調用網絡爬蟲調度模組的自定義子過程創建自定義菜單欄
End Sub
' Excel 文檔關閉前的操作
Private Sub Workbook_BeforeClose(Cancel As Boolean)
On Error Resume Next
'Call DatabaseDispatchModule.callRemoveModule '調用鏈接操控數據庫調度模組的自定義子過程移除清理程序自動導入的模塊
''Call DatabaseDispatchModule.callKillProcess '調用鏈接操控數據庫調度模組的自定義子過程關閉清理程序自動創建的進程
''ThisWorkbook.Save
'Call AlgorithmDispatchModule.callRemoveModule '調用統計計算方法調度模組的自定義子過程移除清理程序自動導入的模塊
''Call AlgorithmDispatchModule.callKillProcess '調用統計計算方法調度模組的自定義子過程關閉清理程序自動創建的進程
''ThisWorkbook.Save
'Call CrawlerDispatchModule.callRemoveModule '調用網絡爬蟲調度模組的自定義子過程移除清理程序自動導入的模塊
''Call CrawlerDispatchModule.callKillProcess '調用網絡爬蟲調度模組的自定義子過程關閉清理程序自動創建的進程
''ThisWorkbook.Save
'ThisWorkbook.Save
End Sub