-
Notifications
You must be signed in to change notification settings - Fork 6
/
ThisWorkbook.cls
39 lines (37 loc) · 1.11 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
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
Option Explicit
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Dim Folder As String, File As String
Folder = Environ("TEMP")
File = Dir(Folder & "\ExcelToGit*")
Do While File <> ""
Kill Folder & "\" & File
File = Dir
Loop
End Sub
Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal Target As Range)
Dim Txt As String, C As Integer
If Target.Rows.Count > 1 Then Exit Sub
If Target.Row > 1 And Target.Columns.Count > 1 Then Exit Sub
C = Target.Column
If C = COL_EXPORT Or C = COL_GIT_GUI Or C = COL_GITK Or C = COL_GIT_BASH Then
Txt = Target.Cells(1, 1).Value2
Select Case Txt
Case "Refresh list of open documents": Refresh
Case "Export": Export
Case "Git gui": GitGui
Case "gitk": Gitk
Case "bash": GitBash
End Select
ElseIf C = COL_GIT_FOLDER Or C = COL_FILE_FOLDER Then
OpenFolder Cells(Target.Row, C)
End If
End Sub