I have a RibbonX customization for Excel. It's quite simple and it
works fine... But, I'm trying to make the buttons that I have behave
like the controls in Excel such that when there is no Workbook visible
in Excel I want to disable the buttons.

It appears that I want to invalidate my buttons and call the "enabled"
dynamic attribute, but I can't figure out 2 things:

1. How to recognize that the Excel Workspace has no visible
Workbooks, and
2. Where to put the code the will recognize when a Workbook has been
closed or hidden so that I can do the test in #1 and respond
accordingly.

Thanks for the help!!

Re: RibbonX Customization Question by Jon

Jon
Thu Jul 24 10:42:37 CDT 2008

You probably need an add-in loaded that has an application events class
module (look for events on http://cpearson.com). Whenever the workbook_open,
_close, _activate, and _deactivate events fire, you need to test for
workbooks.

1. Check for ActiveWorkbook Is Nothing
2. As stated, in an add-in (perhaps the one with the ribbon customization).

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
Peltier Technical Services, Inc. - http://PeltierTech.com
_______


<brplummer@gmail.com> wrote in message
news:8306760c-28dd-475d-af12-81db927ef37b@79g2000hsk.googlegroups.com...
>I have a RibbonX customization for Excel. It's quite simple and it
> works fine... But, I'm trying to make the buttons that I have behave
> like the controls in Excel such that when there is no Workbook visible
> in Excel I want to disable the buttons.
>
> It appears that I want to invalidate my buttons and call the "enabled"
> dynamic attribute, but I can't figure out 2 things:
>
> 1. How to recognize that the Excel Workspace has no visible
> Workbooks, and
> 2. Where to put the code the will recognize when a Workbook has been
> closed or hidden so that I can do the test in #1 and respond
> accordingly.
>
> Thanks for the help!!
>
>
>



Re: RibbonX Customization Question by Ron

Ron
Thu Jul 24 10:48:35 CDT 2008

I like to this in the macro

Very simple

On Error Resume Next
ActiveSheet.Select
If Err.Number > 0 Then
MsgBox "There is no workbook open"
Err.Clear
On Error GoTo 0
Else

'Your code


End If


--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"Jon Peltier" <jonxlmvpNO@SPAMpeltiertech.com> wrote in message news:OxJ%23sPa7IHA.1468@TK2MSFTNGP05.phx.gbl...
> You probably need an add-in loaded that has an application events class
> module (look for events on http://cpearson.com). Whenever the workbook_open,
> _close, _activate, and _deactivate events fire, you need to test for
> workbooks.
>
> 1. Check for ActiveWorkbook Is Nothing
> 2. As stated, in an add-in (perhaps the one with the ribbon customization).
>
> - Jon
> -------
> Jon Peltier, Microsoft Excel MVP
> Tutorials and Custom Solutions
> Peltier Technical Services, Inc. - http://PeltierTech.com
> _______
>
>
> <brplummer@gmail.com> wrote in message
> news:8306760c-28dd-475d-af12-81db927ef37b@79g2000hsk.googlegroups.com...
>>I have a RibbonX customization for Excel. It's quite simple and it
>> works fine... But, I'm trying to make the buttons that I have behave
>> like the controls in Excel such that when there is no Workbook visible
>> in Excel I want to disable the buttons.
>>
>> It appears that I want to invalidate my buttons and call the "enabled"
>> dynamic attribute, but I can't figure out 2 things:
>>
>> 1. How to recognize that the Excel Workspace has no visible
>> Workbooks, and
>> 2. Where to put the code the will recognize when a Workbook has been
>> closed or hidden so that I can do the test in #1 and respond
>> accordingly.
>>
>> Thanks for the help!!
>>
>>
>>
>
>