Hi all, I'm not very good at VBA, and had help achieving the following code from MrExcel. My problem is I only want it to work on the workbook called "Journal", but it
seems to work on all workbooks, hoping someone can advise on how to modify
This part is in "This Workbook" (Visual basic) in "Journal" workbook
Private Sub Workbook_Open()
Call Maximize_Workspace(True)
Application.OnKey "^z", "UnMaximize_Workspace"
End Sub
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Call Disable_Key
End Sub
This is the macro
Sub Test__Maximize_Workspace()
Call Maximize_Workspace(True)
End Sub
Sub Maximize_Workspace(trueOrFalse As Boolean)
If trueOrFalse = True Then
Application.DisplayStatusBar = False
Application.DisplayFormulaBar = False
ActiveWindow.DisplayHeadings = False
ActiveWindow.DisplayGridlines = False
Call Show_Top_Ribbon(False)
Else
Application.DisplayStatusBar = True
Application.DisplayFormulaBar = True
ActiveWindow.DisplayHeadings = True
ActiveWindow.DisplayGridlines = True
Call Show_Top_Ribbon(True)
End If
End Sub
Sub Test__Show_Top_Ribbon()
Call Show_Top_Ribbon(True)
End Sub
Sub Show_Top_Ribbon(hideUnhide As Boolean)
If hideUnhide = True Then
Application.ExecuteExcel4Macro "show.toolbar(""Ribbon"",True)"
Else
Application.ExecuteExcel4Macro "show.toolbar(""Ribbon"",False)"
End If
End Sub
Sub Disable_Key()
Application.OnKey "^z", "Do_Nothing"
End Sub
Sub Do_Nothing()
'Do nothing
End Sub
Sub UnMaximize_Workspace()
Call Maximize_Workspace(False)
End Sub
seems to work on all workbooks, hoping someone can advise on how to modify
This part is in "This Workbook" (Visual basic) in "Journal" workbook
Private Sub Workbook_Open()
Call Maximize_Workspace(True)
Application.OnKey "^z", "UnMaximize_Workspace"
End Sub
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Call Disable_Key
End Sub
This is the macro
Sub Test__Maximize_Workspace()
Call Maximize_Workspace(True)
End Sub
Sub Maximize_Workspace(trueOrFalse As Boolean)
If trueOrFalse = True Then
Application.DisplayStatusBar = False
Application.DisplayFormulaBar = False
ActiveWindow.DisplayHeadings = False
ActiveWindow.DisplayGridlines = False
Call Show_Top_Ribbon(False)
Else
Application.DisplayStatusBar = True
Application.DisplayFormulaBar = True
ActiveWindow.DisplayHeadings = True
ActiveWindow.DisplayGridlines = True
Call Show_Top_Ribbon(True)
End If
End Sub
Sub Test__Show_Top_Ribbon()
Call Show_Top_Ribbon(True)
End Sub
Sub Show_Top_Ribbon(hideUnhide As Boolean)
If hideUnhide = True Then
Application.ExecuteExcel4Macro "show.toolbar(""Ribbon"",True)"
Else
Application.ExecuteExcel4Macro "show.toolbar(""Ribbon"",False)"
End If
End Sub
Sub Disable_Key()
Application.OnKey "^z", "Do_Nothing"
End Sub
Sub Do_Nothing()
'Do nothing
End Sub
Sub UnMaximize_Workspace()
Call Maximize_Workspace(False)
End Sub