MattS
Crabby Cancerian.....
- Local time
- Today, 06:09
- Joined
- Jun 18, 2003
- Messages
- 130
I was hoping somebody could explain how bitwise comparisons work?
The following subroutine (written by somebody else!) sets up a shortcut menu. I'm ok with all of this, except the comparison - i.e. (showoption And 1)
I do not understand how this could return the true/false value needed to set the visible property.
Any help appreciated.
Matt.
NB: Showoption = 0, 5, or 7
The following subroutine (written by somebody else!) sets up a shortcut menu. I'm ok with all of this, except the comparison - i.e. (showoption And 1)
I do not understand how this could return the true/false value needed to set the visible property.
Any help appreciated.
Matt.
NB: Showoption = 0, 5, or 7
Code:
Public Sub SetupMenuOutput(PagenamE As String, Button As Label, Showoption As Integer)
'Sets up rightmouse menu options. Requires maintab pagename, Button to depress and menu options to enable
'3 menuoptions available set by binary 'And'ing. Insert onaction strings into menu
Set mbar = CommandBars("output")
With mbar
.Controls(1).Visible = (Showoption And 1) 'Print
.Controls(2).Visible = (Showoption And 2) 'XL
.Controls(3).Visible = (Showoption And 4) 'View
If Showoption = 0 Then Exit Sub
.Controls(1).OnAction = "=outputprint('" & ThisPrint & "')"
.Controls(2).OnAction = "=OutputXL('" & ThisXL & "')"
.Controls(3).OnAction = "=showpages ('" & PagenamE & "', forms!master!" & Button.Name & ")"
End With
End Sub
Last edited: