I have the Function below that is suppose to set the property for the items below to True or False. I am able to do it on all properties except for this one:
.Application.ExecuteExcel4Macro("Show.ToolBar(""Ribbon"", False)")
When I try to replace False with my parameter boolStatus, and I run the function, it will not change. So I gave up and just left it as False, but I really needed to change from False to True and vice versa otherwise my function is only half working. As it stands right now, I would have to create a second function where I would set the line to True, I am pretty certain that is double work.
Module sheetView
Public xlWB As Excel.Workbook = CType(Globals.ThisWorkbook.Application.ActiveWorkbook, Excel.Workbook)
Public xlWS As Excel.Worksheet = CType(xlWB.ActiveSheet, Excel.Worksheet)
Function ViewSheets(boolStatus As Boolean) As String
'This function selects a dashboard and hides
'the gridlines, headings, tabs and toolbar.
'@parameter sheetName, calls the sheet to be selected
'@parameter status, sets the objects to view or hide
With xlWS
.Application.ScreenUpdating = False
'Disable the following controls
.Application.ActiveWindow.DisplayGridlines = boolStatus
.Application.ActiveWindow.DisplayHeadings = boolStatus
.Application.ActiveWindow.DisplayWorkbookTabs = boolStatus
.Application.DisplayFormulaBar = boolStatus
.Application.DisplayStatusBar = boolStatus
.Application.ExecuteExcel4Macro("Show.ToolBar(""Ribbon"", False)")
.Application.ScreenUpdating = True
End With
Return ""
End Function
End Module
What am I doing wrong with that line?
.Application.ExecuteExcel4Macro("Show.ToolBar(""Ribbon"", " + boolStatus + ")")?