davewatson86
New Member
- Joined
- Jul 8, 2019
- Messages
- 30
Hello all
my vba knowledge is quite limited so please be patient.
have this code to hide the ribbon and all the unnecessary excel bits from the user.
it works a treat except when i open a workbook that has macros it throws an error because it is trying to show the ribbon etc before the user has clicked "Enable Editing" and "Enable Macros".
is there a way to make the code in this workbook wait until the user has allowed editing and macros in the new book?
any help is greatly appreciated.
code below.
Code in thisworkbook
code in normal module
in each worksheet
my vba knowledge is quite limited so please be patient.
have this code to hide the ribbon and all the unnecessary excel bits from the user.
it works a treat except when i open a workbook that has macros it throws an error because it is trying to show the ribbon etc before the user has clicked "Enable Editing" and "Enable Macros".
is there a way to make the code in this workbook wait until the user has allowed editing and macros in the new book?
any help is greatly appreciated.
code below.
Code in thisworkbook
Code:
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Application.ExecuteExcel4Macro "SHOW.TOOLBAR(""Ribbon"",True)"
Application.DisplayFormulaBar = True
Call normal
ActiveWorkbook.Save
End Sub
Private Sub Workbook_Open()
Application.ExecuteExcel4Macro "SHOW.TOOLBAR(""Ribbon"",False)"
Application.DisplayFormulaBar = False
Call masque
End Sub
Sub Workbook_Activate()
Application.EnableEvents = False
Call masque
Application.EnableEvents = True
End Sub
Sub Workbook_Deactivate()
Application.EnableEvents = False
Call normal
Application.EnableEvents = True
End Sub
code in normal module
Code:
Sub masque()
With Application
.ScreenUpdating = False
.ExecuteExcel4Macro "SHOW.TOOLBAR(""Ribbon"",False)"
.DisplayFormulaBar = False
.DisplayStatusBar = False
.ScreenUpdating = True
End With
With ActiveWindow
.DisplayHeadings = False
.DisplayGridlines = False
.DisplayHorizontalScrollBar = False
.DisplayVerticalScrollBar = False
End With
End Sub
Sub normal()
With ActiveWindow
.DisplayHorizontalScrollBar = True
.DisplayVerticalScrollBar = True
.DisplayHeadings = True
.DisplayGridlines = True
End With
With Application
.ScreenUpdating = False
.DisplayFormulaBar = True
.DisplayStatusBar = True
.ExecuteExcel4Macro "SHOW.TOOLBAR(""Ribbon"",True)"
.ScreenUpdating = True
End With
End Sub
in each worksheet
Code:
Private Sub Worksheet_Activate()
Call masque
End Sub