Click here to Skip to main content
15,914,111 members
Home / Discussions / Visual Basic
   

Visual Basic

 
Questionsql server Pin
bapu28898-May-08 9:52
bapu28898-May-08 9:52 
AnswerRe: sql server Pin
Dave Kreskowiak8-May-08 10:20
mveDave Kreskowiak8-May-08 10:20 
QuestionRe: sql server Pin
bapu28899-May-08 9:01
bapu28899-May-08 9:01 
AnswerRe: sql server Pin
Dave Kreskowiak9-May-08 13:54
mveDave Kreskowiak9-May-08 13:54 
QuestionRe: sql server Pin
bapu288910-May-08 7:29
bapu288910-May-08 7:29 
AnswerRe: sql server Pin
Dave Kreskowiak10-May-08 9:07
mveDave Kreskowiak10-May-08 9:07 
QuestionRe: sql server Pin
bapu288910-May-08 23:12
bapu288910-May-08 23:12 
QuestionDisappearing custom CommandBar menu in Excel Pin
dsimms8-May-08 8:05
dsimms8-May-08 8:05 
We use spreadsheets with 40+ worksheets in the workbook. I have written a VBA macro to help navigate to specific worksheets. I read the names of all the sheets into an array, check each name for certain keywords, then load the name as a sub-menu of grouped menus.

The macro works fine with one exception, whenever a chart sheet is selected from the menu that chart is displayed but the custom menu disappears. Then if a non-chart worksheet is manually selected, then the custom menu reappears and works normally.

Thanks for any help.

A pertinent parts of the code which shows the same behavior is listed here:

' Macros by D. Simms
' with heavy reliance on Microsoft Excel 2000 Power Programming with VBA by John Walkenbach
' easier worksheet navigation in work books with a large number of worksheets
' arranges worksheets into groups with separate sheets in sub menus
' Auto_open and close macros are in the "ThisWorkbook" object code

Public SheetData() As String
Public ShtCount, ShtNumber As Integer ' these are all sheets visible and hidden
Public CurrentSheet As Object

Dim MenuSheet As Object 'Worksheet
Dim MenuObject As CommandBarPopup

Dim MenuItem As Object
Dim SubMenuItem As CommandBarButton

Dim Counter As Integer
Dim NumSheets As Integer 'this is the number of visible sheets


Sub IBWMenu()
' adds menu to navigate to one of the worksheets

' call get sheet list routine
Call FillWorksheetArray

' delete previous menu bar if it exists
Call DeleteIBWMenu

' add menu and submenus
Call AddIBWMenu

End Sub

Sub AddIBWMenu()
'Add IBW menubar just before help menu
Dim HelpMenu As CommandBarControl

' find Help menu
Set HelpMenu = CommandBars(1).FindControl(ID:=30010)

Set MenuObject = Application.CommandBars(1). _
Controls.Add(Type:=msoControlPopup, _
Before:=HelpMenu.Index, _
Temporary:=True)
MenuObject.Caption = "I&BW Worksheets" ' Name of menu; change to suit

'add menu categories
Set MenuItem = MenuObject.Controls.Add(Type:=msoControlPopup)
MenuItem.Caption = "&Tabs"
For Counter = 1 To NumSheets
If SheetData(Counter, 2) = "Tab" Then
Set SubMenuItem = MenuItem.Controls.Add
SubMenuItem.Caption = SheetData(Counter, 1)
SubMenuItem.OnAction = "SelectSheet"
End If
Next Counter
Set MenuItem = MenuObject.Controls.Add(Type:=msoControlPopup)
MenuItem.Caption = "&Charts"
For Counter = 1 To NumSheets
If SheetData(Counter, 2) = "Chart" Then
Set SubMenuItem = MenuItem.Controls.Add
SubMenuItem.Caption = SheetData(Counter, 1)
SubMenuItem.OnAction = "SelectSheet"
End If
Next Counter
Set MenuItem = MenuObject.Controls.Add(Type:=msoControlPopup)
MenuItem.Caption = "&Data"
For Counter = 1 To NumSheets
If SheetData(Counter, 2) = "Data" Then
Set SubMenuItem = MenuItem.Controls.Add
SubMenuItem.Caption = SheetData(Counter, 1)
SubMenuItem.OnAction = "SelectSheet"
End If
Next Counter
Set MenuItem = MenuObject.Controls.Add(Type:=msoControlPopup)
MenuItem.Caption = "&Other"
For Counter = 1 To NumSheets
If SheetData(Counter, 2) = "Other" Then
Set SubMenuItem = MenuItem.Controls.Add
SubMenuItem.Caption = SheetData(Counter, 1)
SubMenuItem.OnAction = "SelectSheet"
End If
Next Counter
Set MenuItem = MenuObject.Controls.Add(Type:=msoControlButton)
MenuItem.Caption = "&Reset"
MenuItem.BeginGroup = True
MenuItem.OnAction = "ResetIBWMenu"

End Sub
Questionfread() equivalent in VB? Pin
Phyxion8-May-08 7:49
Phyxion8-May-08 7:49 
AnswerRe: fread() equivalent in VB? Pin
Tim Carmichael8-May-08 7:56
Tim Carmichael8-May-08 7:56 
GeneralRe: fread() equivalent in VB? Pin
Phyxion8-May-08 8:08
Phyxion8-May-08 8:08 
AnswerRe: fread() equivalent in VB? Pin
Phyxion8-May-08 9:26
Phyxion8-May-08 9:26 
GeneralRe: fread() equivalent in VB? Pin
Anubhava Dimri8-May-08 19:57
Anubhava Dimri8-May-08 19:57 
Questionhow can made msn messenger or windows messenger in vb.net?please send me coding of this application and send me msn messenger application in vb.net Pin
mohammedali20068-May-08 7:48
mohammedali20068-May-08 7:48 
AnswerRe: how can made msn messenger or windows messenger in vb.net?please send me coding of this application and send me msn messenger application in vb.net Pin
Tim Carmichael8-May-08 7:58
Tim Carmichael8-May-08 7:58 
AnswerRe: how can made msn messenger or windows messenger in vb.net?please send me coding of this application and send me msn messenger application in vb.net Pin
Christian Graus8-May-08 14:04
protectorChristian Graus8-May-08 14:04 
AnswerRe: how can made msn messenger or windows messenger in vb.net?please send me coding of this application and send me msn messenger application in vb.net Pin
parth.p8-May-08 14:08
parth.p8-May-08 14:08 
AnswerRe: how can made msn messenger or windows messenger in vb.net?please send me coding of this application and send me msn messenger application in vb.net Pin
Jamal Abdul Nasir10-May-08 3:22
Jamal Abdul Nasir10-May-08 3:22 
QuestionPublishing an application with the framework 3.5 Pin
Paul McGann8-May-08 6:57
professionalPaul McGann8-May-08 6:57 
AnswerRe: Publishing an application with the framework 3.5 Pin
Dave Kreskowiak8-May-08 8:36
mveDave Kreskowiak8-May-08 8:36 
GeneralRe: Publishing an application with the framework 3.5 Pin
Paul McGann8-May-08 10:03
professionalPaul McGann8-May-08 10:03 
GeneralRe: Publishing an application with the framework 3.5 Pin
Dave Kreskowiak8-May-08 10:18
mveDave Kreskowiak8-May-08 10:18 
QuestionHow to find dimetions of Image Pin
nishkarsh_k8-May-08 6:54
nishkarsh_k8-May-08 6:54 
AnswerRe: How to find dimetions of Image Pin
Dave Kreskowiak8-May-08 8:31
mveDave Kreskowiak8-May-08 8:31 
QuestionBG Image Pin
Jamal Abdul Nasir8-May-08 3:58
Jamal Abdul Nasir8-May-08 3:58 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.