-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclsFileState.cls
More file actions
93 lines (78 loc) · 2.6 KB
/
Copy pathclsFileState.cls
File metadata and controls
93 lines (78 loc) · 2.6 KB
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
83
84
85
86
87
88
89
90
91
VERSION 1.0 CLASS
BEGIN
MultiUse = -1 'True
END
Attribute VB_Name = "clsFileState"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
'@Description: Estado relacionado con el archivo Excel activo
'@Category: State
'@Folder "2-Infraestructura.1-Estado"
Option Explicit
Private Const MODULE_NAME As String = "clsFileState"
' ==========================================
' ESTADO DE ARCHIVO
' ==========================================
Private mCurrentFile As clsFileXLS
' ==========================================
' INICIALIZACIÓN
' ==========================================
Private Sub Class_Initialize()
Set mCurrentFile = Nothing
End Sub
Private Sub Class_Terminate()
Set mCurrentFile = Nothing
End Sub
' ==========================================
' PROPIEDADES PÚBLICAS
' ==========================================
'@Description: Obtiene o establece el archivo Excel activo actual
Public Property Get CurrentFile() As clsFileXLS
Set CurrentFile = mCurrentFile
End Property
Friend Property Set CurrentFile(f As clsFileXLS)
Set mCurrentFile = f
LogDebug MODULE_NAME, "[CurrentFile] Changed to: " & GetCurrentFileName()
End Property
'@Description: Indica si el archivo actual es un archivo de oportunidad
Public Property Get IsOpportunityFile() As Boolean
If mCurrentFile Is Nothing Then Exit Property
IsOpportunityFile = mCurrentFile.IsOpportunityFile
End Property
' ==========================================
' CONSULTAS DE ESTADO
' ==========================================
'@Description: Indica si hay un archivo actualmente activo
Public Function HasCurrentFile() As Boolean
HasCurrentFile = Not (mCurrentFile Is Nothing)
End Function
'@Description: Obtiene el nombre del archivo actual
'@Returns: String con el nombre del archivo o "(ninguno)"
Public Function GetCurrentFileName() As String
If mCurrentFile Is Nothing Then
GetCurrentFileName = "(ninguno)"
Else
On Error Resume Next
GetCurrentFileName = mCurrentFile.Name
If Err.Number <> 0 Then
GetCurrentFileName = "(error)"
End If
On Error GoTo 0
End If
End Function
'@Description: Obtiene el path completo del archivo actual
'@Returns: String con el path o cadena vacía
Public Function GetCurrentFilePath() As String
If mCurrentFile Is Nothing Then
GetCurrentFilePath = ""
Else
On Error Resume Next
GetCurrentFilePath = mCurrentFile.path
If Err.Number <> 0 Then
GetCurrentFilePath = ""
End If
On Error GoTo 0
End If
End Function