ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Letting buttons depend on the sheet? (https://www.excelbanter.com/excel-programming/410482-letting-buttons-depend-sheet.html)

Gustaf

Letting buttons depend on the sheet?
 
I'm using Excel 2007. I wonder if it's possible with VBA to have different buttons appear for different sheets? That is, when I go from one sheet to another, some buttons shall disappear and some shall appear, so that only the set of buttons relevant to the active sheet is visible. If this is not possible, are there other ways to achieve something similar?

Gustaf

Gustaf

Letting buttons depend on the sheet?
 
Gustaf wrote:
I'm using Excel 2007. I wonder if it's possible with VBA to have
different buttons appear for different sheets? That is, when I go from
one sheet to another, some buttons shall disappear and some shall
appear, so that only the set of buttons relevant to the active sheet is
visible. If this is not possible, are there other ways to achieve
something similar?


Just to clarify, I'm talking about toolbar buttons that activate custom VBA macros.

Gustaf

Jim Rech

Letting buttons depend on the sheet?
 
Excel 2007 doesn't have toolbar buttons so I presume you're talking about
adding custom buttons to the ribbon, either a build-in tab or a custom tab.
Having such buttons appear and disappear when switching worksheets would
take a combination of RibbonX and VBA. If you've already build your ribbonx
you'd just have to use the getVisible callback to return the current visible
state when the ribbon is invalidated. And you'd have to invalidate the
ribbon with the sheet activate or deactivate event.

If you're not all that familiar with customizing the ribbon you can either
drive into it or, if you haven't got the time, maybe you could just insert
buttons from the Developer tab directly on the worksheets and hook your
macros to them.

--
Jim
"Gustaf" wrote in message
...
| Gustaf wrote:
| I'm using Excel 2007. I wonder if it's possible with VBA to have
| different buttons appear for different sheets? That is, when I go from
| one sheet to another, some buttons shall disappear and some shall
| appear, so that only the set of buttons relevant to the active sheet is
| visible. If this is not possible, are there other ways to achieve
| something similar?
|
| Just to clarify, I'm talking about toolbar buttons that activate custom
VBA macros.
|
| Gustaf




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

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