A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » New Users
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Ribbon



 
 
Thread Tools Display Modes
  #1  
Old May 31st, 2010, 09:20 PM posted to microsoft.public.access.gettingstarted
TonyAntique via AccessMonster.com
external usenet poster
 
Posts: 4
Default Ribbon

I have succeeded in using Albert D Kallal ' s brilliant code to control a
Ribbon on a form.
The only problem I cannot solve is how to make some buttons invisible when
the form loads.
If I put the meRib("btSearch").visible = False in Form_Active or Form_Current.

I get the runtime error '2475' you entered an expression that requires a form
to be the active window.
Any suggestions would be great.

--
Message posted via http://www.accessmonster.com

  #2  
Old June 2nd, 2010, 05:42 PM posted to microsoft.public.access.gettingstarted
tighe
external usenet poster
 
Posts: 53
Default Ribbon

first make sure you have an onLoad="OnRibbonLoad" to start for your ribbon
item.

customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui"
onLoad="OnRibbonLoad"

the vba:
Public Sub OnRibbonLoad(objRibbon As IRibbonUI)
Set gobjRibbon = objRibbon
End Sub

second for the object(button/toggle, etc.) will need to add a
getEnabled="Somename" ' name of the code it will call

button id="cmdADV" getVisible="GetVisible" / ' leaving out other useful
ribbon attributes for clarification.

vba:
Public Sub GetVisible(ctl As IRibbonControl, ByRef Visible As Variant)
gobjRibbon.Invalidate

Select Case ctl.ID ' what ribbon property will be used to find items to enable
Case "cmdADV": Set Visible = Forms![Firm_Address]![IA] 'reason visible
Case "cmdCE": Set Visible = Forms![Firm_Address]![BD] 'other button
id(s), uses the same code
Case "grpChecklist": Set Visible = [Forms]![WSP_RegCat_Select]![Check2]
End Select

End Sub

in this code you will notice it uses Case, so in essence you can load all
items into one Sub referenced by their "id." of course the reason/value you
use to
enabled/disabled is up to you.

without going to much else farther you can replace ID, with Tag so maybe you
have a bunch of similar function buttons that will be visibleat the same
time. GetEnable works almost the same way.

hope that helps, i will try to watch for any response, i dont recieve the
emails anymore.

"TonyAntique via AccessMonster.com" wrote:

I have succeeded in using Albert D Kallal ' s brilliant code to control a
Ribbon on a form.
The only problem I cannot solve is how to make some buttons invisible when
the form loads.
If I put the meRib("btSearch").visible = False in Form_Active or Form_Current.

I get the runtime error '2475' you entered an expression that requires a form
to be the active window.
Any suggestions would be great.

--
Message posted via http://www.accessmonster.com

.

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 03:01 PM.


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