Results 1 to 7 of 7

Navigation Command Bar

Threaded View

  1. #1
    Registered User
    Join Date
    02-03-2005
    Posts
    44

    Navigation Command Bar

    This code puts a navigation bar in your workbook to easily navigate between sheets. I found it at a site. The command bar opens when I put the code under workbook in VBA. Only I am not an expert and do not 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 Sub
    Last edited by VBA Noob; 03-14-2008 at 02:53 PM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1