Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default Access RibbonUI object from Application?

Is it possible to navigate to the IRibbonUI object for Excel from the
Application object? I know that I can get addressability to the Ribbon UI
object with on onLoad callback, but saving that in a global variable in VBA
is problematic: If any macro ever encounters an error, VBA clears all the
global variables. I'd like to be able to get back reliably to my customized
part of the Ribbon from my code, later, to do things like enable/disable
buttons, and to "invalidate" it so that it rebuilds the dynamic menus.

For the "old" code I have, using Menus, I've been able to get to the menus
from the CommandBars property of the Application. But I don't see any way to
navigate to the Ribbon stuff. I've searched MSDN and various forums, without
finding an answer.

Thanks in advance for any tips or pointers.
--
Don H.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Access RibbonUI object from Application?

Hi donh

See the example file on this page
http://www.rondebruin.nl/ribbon.htm

Point 3, example 1



--

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


"donh" wrote in message ...
Is it possible to navigate to the IRibbonUI object for Excel from the
Application object? I know that I can get addressability to the Ribbon UI
object with on onLoad callback, but saving that in a global variable in VBA
is problematic: If any macro ever encounters an error, VBA clears all the
global variables. I'd like to be able to get back reliably to my customized
part of the Ribbon from my code, later, to do things like enable/disable
buttons, and to "invalidate" it so that it rebuilds the dynamic menus.

For the "old" code I have, using Menus, I've been able to get to the menus
from the CommandBars property of the Application. But I don't see any way to
navigate to the Ribbon stuff. I've searched MSDN and various forums, without
finding an answer.

Thanks in advance for any tips or pointers.
--
Don H.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default Access RibbonUI object from Application?

Hi Ron,
Thank you, it's kind of you to help, but I had already looked at that code,
and unfortunately it doesn't answer my question. The example code uses the
module-level variable 'Rib" to access the ribbon, having set that variable in
the onLoad callback. Sometimes things go wrong in macros (yes, I know, they
shouldn't...but they do) and if there is any error, even in a macro that has
nothing to do with ribbons, the variable Rib gets set back to Nothing, at
which point there's no way to find the Ribbon objects again.

My question is whether there is any independent way for VB code to navigate
to the Ribbon objects, perhaps starting with the Application object (or any
other always-accessible place)? I would like my module to be essentially
"stateless" and not depend on that global variable remaining set. In the
pre-ribbon days, one could navigate from the Application.CommandBars property
and find all the menu objects. This doesn't appear to work the same way for
ribbons, and I'm looking for the comparable technique.
--
Don H.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Access RibbonUI object from Application?

Hi Don H.

I will try a few things this weekend to avoid this problem


--

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


"donh" wrote in message ...
Hi Ron,
Thank you, it's kind of you to help, but I had already looked at that code,
and unfortunately it doesn't answer my question. The example code uses the
module-level variable 'Rib" to access the ribbon, having set that variable in
the onLoad callback. Sometimes things go wrong in macros (yes, I know, they
shouldn't...but they do) and if there is any error, even in a macro that has
nothing to do with ribbons, the variable Rib gets set back to Nothing, at
which point there's no way to find the Ribbon objects again.

My question is whether there is any independent way for VB code to navigate
to the Ribbon objects, perhaps starting with the Application object (or any
other always-accessible place)? I would like my module to be essentially
"stateless" and not depend on that global variable remaining set. In the
pre-ribbon days, one could navigate from the Application.CommandBars property
and find all the menu objects. This doesn't appear to work the same way for
ribbons, and I'm looking for the comparable technique.
--
Don H.

Reply
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
VB6 and the Excel.Application Object [email protected] Excel Programming 2 July 31st 07 09:06 PM
adding custom macro controls to Fluent RibbonUI SteveDB1 Excel Programming 6 May 24th 07 05:16 PM
getting started on Fluent RibbonUI SteveDB1 Excel Programming 2 May 23rd 07 07:54 PM
excel application object josef123 Excel Programming 1 October 16th 06 01:14 PM
Access.Application.Quit - opens Access again then won't close - He Hluhluwe Excel Programming 0 January 30th 06 11:17 AM


All times are GMT +1. The time now is 01:47 AM.

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

About Us

"It's about Microsoft Excel"