hamistasty
Board Regular
- Joined
- May 17, 2011
- Messages
- 208
I'm wanting to create a macro that acts as a toggle button but isn't an actual toggle button
This is what happens when the file opens:
This is the button (module) code:
The error is that toggle isn't defined. What am I doing wrong?
This is what happens when the file opens:
Code:
Private Sub Workbook_Open()
Application.ExecuteExcel4Macro "SHOW.TOOLBAR(""Ribbon"",False)"
Application.DisplayFormulaBar = False
Application.DisplayStatusBar = False
Public toggle As Long
Set toggle = 1
End Sub
This is the button (module) code:
Code:
Public Sub UnHideNavPane()
If toggle = 1 Then
Application.ExecuteExcel4Macro "SHOW.TOOLBAR(""Ribbon"",True)"
Application.DisplayFormulaBar = True
Application.DisplayStatusBar = True
Set toggle = 0
ElseIf toggle = 0 Then
Application.ExecuteExcel4Macro "SHOW.TOOLBAR(""Ribbon"",False)"
Application.DisplayFormulaBar = False
Application.DisplayStatusBar = False
Set toggle = 1
Else
End If
End Sub
The error is that toggle isn't defined. What am I doing wrong?