-
Notifications
You must be signed in to change notification settings - Fork 0
/
bas_lib_vba_0001.bas
96 lines (92 loc) · 3.62 KB
/
bas_lib_vba_0001.bas
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
92
93
94
95
96
' -----------------------------------------------------------------------
' vbaMyLib Version: 0.1.2 Release Date: 20170123
' © Copyright 2001-2023 Manu Herrán
' Free download source code:
' http://manuherran.com/
' -----------------------------------------------------------------------
Option Explicit
' -----------------------------------------------------------------------
' Tested with Access 2003
' -----------------------------------------------------------------------
' Funciones
' -----------------------------------------------------------------------
' vba_0001_fInit
' vba_0001_fCalculatePath
' vba_0001_fExitOfficeApp
' vba_0001_fCloseFormAndExit
' vba_0001_fStopVba
'
' -----------------------------------------------------------------------
Global GLO_office_driver_app As String
Global GLO_office_driver_version As String
Global GLO_excel_output_file_extension As String
Global GLO_filedialog_managed_by As String
' -----------------------------------------------------------------------
Global Const CTE_GLO_office_driver_app_excel As String = "EXCEL"
Global Const CTE_GLO_office_driver_app_access As String = "ACCESS"
Global Const CTE_GLO_office_driver_app_ppt As String = "PPT"
' -----------------------------------------------------------------------
Global Const CTE_VB_DataType_Integer As Integer = 4
Global Const CTE_VB_DataType_Double As Integer = 7
Global Const CTE_VB_DataType_Date As Integer = 8
Global Const CTE_VB_DataType_String As Integer = 10
' -----------------------------------------------------------------------
Sub vba_0001_fInit()
'----------------------------------------------------------------------
' OFFICE
' GLO_office_driver_app = CTE_GLO_office_driver_app_excel
'----------------------------------------------------------------------
'GLO_filedialog_managed_by = "Office"
GLO_filedialog_managed_by = "Application"
'----------------------------------------------------------------------
' EXCEL
' GLO_office_driver_app = CTE_GLO_office_driver_app_excel
'----------------------------------------------------------------------
'----------------------------------------------------------------------
' ACCESS
GLO_office_driver_app = CTE_GLO_office_driver_app_access
GLO_office_driver_version = Application.Version
Application.SetOption "Auto compact", True
'----------------------------------------------------------------------
'----------------------------------------------------------------------
' POWERPOINT
' GLO_office_driver_app = CTE_GLO_office_driver_app_ppt
'----------------------------------------------------------------------
Select Case GLO_office_driver_version
Case "11.0"
GLO_excel_output_file_extension = ".xls"
Case "14.0"
GLO_excel_output_file_extension = ".xlsx"
Case Else
GLO_excel_output_file_extension = ".xls"
End Select
End Sub
Function vba_0001_fCalculatePath()
Dim ret As String
If GLO_deploy_mode = False Then
vba_0001_fInit
End If
Select Case GLO_office_driver_app
Case CTE_GLO_office_driver_app_excel
'ret = Application.ActiveWorkbook.Path
Case CTE_GLO_office_driver_app_access
ret = Left(CurrentDb.Name, InStrRev(CurrentDb.Name, "\"))
If Right(ret, 1) = "\" Then
ret = Left(ret, Len(ret) - 1)
End If
Case CTE_GLO_office_driver_app_ppt
'ret = ActivePresentation.Path
Case Else
End Select
vba_0001_fCalculatePath = ret
End Function
Sub vba_0001_fExitOfficeApp()
DoCmd.Quit
End Sub
Sub vba_0001_fCloseFormAndExit()
DoCmd.Close acForm, "Form_FRM_MENU_PRINCIPAL"
End
End Sub
Sub vba_0001_fStopVba()
End
End Sub