forked from AllenMattson/VBA_personal
-
Notifications
You must be signed in to change notification settings - Fork 0
/
OpenAndClose.vb
79 lines (54 loc) · 1.97 KB
/
OpenAndClose.vb
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
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Cancel = False
ThisWorkbook.Save
Application.DisplayAlerts = False
Call HideNeeded
Application.ExecuteExcel4Macro "show.toolbar(""Ribbon"", true)"
Application.DisplayAlerts = True
ActiveWindow.DisplayHeadings = True
Application.DisplayFormulaBar = True
ActiveSheet.PageSetup.BlackAndWhite = False
End Sub
Private Sub Workbook_NewSheet(ByVal Sh As Object)
paku_message_title = tbl_settings.Range("AJ8")
If Not tbl_settings.Visible Then
With Application
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Sh.Delete
Application.DisplayAlerts = True
Application.ScreenUpdating = True
End With
MsgBox (Environ("UserName") & ", Sie können Blätter nicht hinzufügen."), vbInformation, paku_message_title
End If
End Sub
Private Sub Workbook_Open()
Call HideNeeded
Application.ExecuteExcel4Macro "show.toolbar(""Ribbon"", false)"
Application.DisplayFormulaBar = False
[set_root_user] = False
Application.Caption = ""
End Sub
Public Sub HideNeeded()
Dim var_Sheet As Variant
Dim arr_visible_sheets As Variant
Dim arr_hidden_sheets As Variant
Call OnStart
arr_visible_sheets = Array(tbl_Input)
arr_hidden_sheets = Array(tbl_1, tbl_2, tbl_3)
For Each var_Sheet In arr_visible_sheets
var_Sheet.Visible = xlSheetVisible
Next var_Sheet
For Each var_Sheet In arr_hidden_sheets
var_Sheet.Visible = xlSheetVeryHidden
Next var_Sheet
Call OnEnd
End Sub
Public Sub UnhideAll()
Dim Sheet As Worksheet
For Each Sheet In ThisWorkbook.Worksheets
' If Sheet.Visible = Not xlSheetVisible Then Sheet.Visible = xlSheetVisible
Sheet.Visible = xlSheetVisible
Next Sheet
Call UnprotectAll
End Sub