ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Highlighting a selection! (https://www.excelbanter.com/excel-programming/297959-highlighting-selection.html)

aiyer[_17_]

Highlighting a selection!
 
Hi all!

Thanks alot Bob and I tried the following as suggsted, to have a chec
mark alongside to indicate it button state.

I,.e, I developed a Vtec menu with sub menus within it and the submenu
were linked to toolbars to which macros are assigned to.

I have assigned macros to toolbars. In one of those macros, I added th
following assuming that the selected toolbar will be highlighted. Fo
eg, one of the toolbars named as 'static' connected to sub-men
'Analysis type' from the 'Vtec ' main menu will have to be highlighte
when the user clicks the same.

==========================================
With Application.CommandBars.ActionControl

If .State = msoButtonUp Then
ActiveWorkbook.Worksheets(.Caption).Visible = xlSheetHidden
.State = msoButtonDown
Else
ActiveWorkbook.Worksheets(.Caption).Visible = xlSheetVisible
.State = msoButtonUp
End If
End With

===========================================

But am getting an error message that says 'subscript error' and in th
debugging mode, I could see that the error was happening at th
following line:

"ActiveWorkbook.Worksheets(.Caption).Visible = xlSheetHidden
.State = msoButtonDown"

I would appreciate your help guys.
Thanks a lot,

Arun.

Vtec corp

--
Message posted from http://www.ExcelForum.com


Bob Phillips[_6_]

Highlighting a selection!
 
That is 2 lines not one. It sets the sheet visible property in one lien, and
then sets the button state in another.

Split it and try again.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"aiyer " wrote in message
...
Hi all!

Thanks alot Bob and I tried the following as suggsted, to have a check
mark alongside to indicate it button state.

I,.e, I developed a Vtec menu with sub menus within it and the submenus
were linked to toolbars to which macros are assigned to.

I have assigned macros to toolbars. In one of those macros, I added the
following assuming that the selected toolbar will be highlighted. For
eg, one of the toolbars named as 'static' connected to sub-menu
'Analysis type' from the 'Vtec ' main menu will have to be highlighted
when the user clicks the same.

==========================================
With Application.CommandBars.ActionControl

If .State = msoButtonUp Then
ActiveWorkbook.Worksheets(.Caption).Visible = xlSheetHidden
State = msoButtonDown
Else
ActiveWorkbook.Worksheets(.Caption).Visible = xlSheetVisible
State = msoButtonUp
End If
End With

===========================================

But am getting an error message that says 'subscript error' and in the
debugging mode, I could see that the error was happening at the
following line:

"ActiveWorkbook.Worksheets(.Caption).Visible = xlSheetHidden
State = msoButtonDown"

I would appreciate your help guys.
Thanks a lot,

Arun.

Vtec corp.


---
Message posted from http://www.ExcelForum.com/




aiyer[_18_]

Highlighting a selection!
 
Thanks Bob.
But it'z not clear how to spli them into 2 lines.

I tried the following and it is still giving me errors.


With Application.CommandBars.ActionControl
If .State = msoButtonUp Then
ActiveWorkbook.Worksheets(.Caption).Visible = xlSheet
Hidden.State = msoButtonDown

Else

ActiveWorkbook.Worksheets(.Caption).Visible = xlSheet
Visible.State = msoButtonUp
End If
End With


Would appreciate ur help.
Arun.

Vtec Corp

--
Message posted from http://www.ExcelForum.com


Bob Phillips[_6_]

Highlighting a selection!
 
Arun,

A thought occurred to me that I haven't explained where that code would go
properly. Your menu will have various controls that have an OnAction
property that will call a macro. The code I gave you was an example of one
of those macros. IT is highly unlikely that you want to hide/show the
activesheet, that was just to make it relevant, but it also shows how to
change the control state.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"aiyer " wrote in message
...
Thanks Bob.
But it'z not clear how to spli them into 2 lines.

I tried the following and it is still giving me errors.


With Application.CommandBars.ActionControl
If .State = msoButtonUp Then
ActiveWorkbook.Worksheets(.Caption).Visible = xlSheet
Hidden.State = msoButtonDown

Else

ActiveWorkbook.Worksheets(.Caption).Visible = xlSheet
Visible.State = msoButtonUp
End If
End With


Would appreciate ur help.
Arun.

Vtec Corp.


---
Message posted from http://www.ExcelForum.com/





All times are GMT +1. The time now is 09:59 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com