LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default Select Case Statement does not evaluate

Hi All,

I am having difficulty specifying the docking order of 3 custom
toolbars (with names equal to that stored in the variables W, F and A)
that are loaded by an add-in application. This code resides in the
ThisWorkbook Module of my xla, and is part of a procedure called by the
Workbook_Open procedure. Specifically, I have had a few variations on
the outcome as I have tried revising the code to get it to work: 1)
Initially, code similar to below but using "If" statements instead of
"Select Case" failed to make two of the three toolbars visible (though
they were enabled, they just were not checked, despite code that should
have made them "visible"); 2) Now, with the code below, NO toolbars are
displayed when my load routine ends (I should also mention that an
earlier section of the code disables the default "Worksheet Menu Bar",
"Standard" and "Formatting" toolbars). Further, when I put a Breakpoint
on the "With Cmd" statement following Case "A", and a Watch with the
Expression "cmd.Name = A", and then step through the code, I can see it
get to the Case "A" statement (and the Watch expression then evaluates
as "True"), but when I press F8, it goes immediately to End Select
without ever executing the code for Case "A". Can anyone advise why
this would happen??

Thanks!

Jeff

Partial code follows:

'At the top of the ThisWorkbook Module:

Public Cmd As Object 'CommandBar name
Public cmdbar As Object
Public W As String
Public A As String
Public F As String

In Workbook_Open:

Set cmdbar = Application.CommandBars


'Partial code in the procedure called from Workbook_Open:

For Each cmd In cmdbar
Select Case cmd.Name

Case "W"
With cmd
.Enabled = True
.Visible = True
.Position = msoBarTop
.Left = 0
.Protection = msoBarNoMove
End With

Case "F"
With cmd
.Enabled = True
.Visible = True
.RowIndex = 2
.Left = 0
.Protection = msoBarNoMove
End With

Case "A"
With cmd
.Enabled = True
.Visible = True
' .RowIndex = msoBarRowLast
.Position = msoBarBottom
.Left = 0
.Protection = msoBarNoMove
End With

End Select

Next

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Select Case Statement Katie Excel Worksheet Functions 13 December 1st 08 07:32 PM
Case without Select Case error problem Ayo Excel Discussion (Misc queries) 2 May 16th 08 03:48 PM
Challenge - evaluate and select mr tom Excel Discussion (Misc queries) 8 March 2nd 07 03:21 PM
Convert If..Else to Select Case Statement. Sheela Excel Programming 1 July 25th 03 09:28 AM
Data validation with the Select Case statement acw Excel Programming 0 July 15th 03 03:16 AM


All times are GMT +1. The time now is 10:30 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"