View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
huntermcg[_15_] huntermcg[_15_] is offline
external usenet poster
 
Posts: 1
Default Navigation Command Bar


This code puts a navigation bar in your workbook to easily navigat
between sheets. I found it at a site. The command bar opens when I pu
the code under workbook in VBA. Only I am not an expert and do no
really understand what to edit before I get it to work in my workbook
Can someone help me with this ??


Navigation Command Bar:

Private Sub Workbook_Open()
On Error Resume Next
Application.CommandBars("Navigate").Delete
On Error GoTo 0

With Application.CommandBars.Add("Navigate XL-Dennis", , False, True)

With .Controls.Add(msoControlButton)
.TooltipText = "Move Back"
.FaceId = 1017
.OnAction = "Move_Back"
.BeginGroup = True
End With

With .Controls.Add(msoControlDropdown)
.AddItem "Sheet1"
.AddItem "Sheet2"
.AddItem "Sheet3"
.TooltipText = "SheetNavigate"
.OnAction = "Sheet_Navigate"
End With

With .Controls.Add(msoControlButton)
.TooltipText = "Move next"
.FaceId = 1018
.OnAction = "Move_Next"
End With

.Protection = msoBarNoCustomize
.Position = msoBarFloating
.Visible = True
End With
End Sub



Private Sub Sheet_Navigate()
Dim stActiveSheet As String

With CommandBars.ActionControl
stActiveSheet = .List(.ListIndex)
End With

Select Case stActiveSheet
Case "Sheet1"
Worksheets("Shee1").Activate
Case "Sheet2"
Worksheets("Sheet2").Activate
Case "Sheet3"
Worksheets("Sheet3").Activate
End Select
End Sub

Private Sub Move_Back()
On Error Resume Next
ActiveSheet.Previous.Select
End Sub

Private Sub Move_Next()
On Error Resume Next
ActiveSheet.Next.Select
End Su

--
huntermc
-----------------------------------------------------------------------
huntermcg's Profile: http://www.excelforum.com/member.php...fo&userid=1939
View this thread: http://www.excelforum.com/showthread.php?threadid=47458