Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Ribbon question...

8 views
Skip to first unread message

Ray

unread,
May 27, 2009, 4:30:01 PM5/27/09
to
Is there a way to programatically (via Access vb) interact with the ribbon
object at the application level?

I've been able to load my custom ribbon via the autoexec macro, and it works
when I apply it to the current database via using the Access options screen.
It also works when applied via code to a form. But is there a way to
programatically change it at the application level so that it applies to all
forms? Something like an Application.Ribbon property?

Albert D. Kallal

unread,
May 29, 2009, 4:28:24 AM5/29/09
to
"Ray" <R...@discussions.microsoft.com> wrote in message
news:937A6050-BAA1-4E50...@microsoft.com...

Not 100% sure I follow your queston? If you set the ribbon in the options
for current database, then that ribbon will apply to all forms.

However, if you have a few forms that need to display/show a dffernt ribbon,
then simply specify the name of that ribbon in the forms "other" property.

You quite much should use the forms property, because then if you have two
or three different forms opened, and each of those forms is to have a
different ribbon, it becomes next to impossible from a coding point of view
to try and start managing all this code yourself that's supposed to know
what ribbon to display at the correct time when a user switches between
different forms.

If you set the ribbon for a form, then access handles all of this changing
of the ribbon for you automatically when the focus changes between different
forms.

You can certainly specified the ribbon that loads in your startup code/form.
Once that ribbon is loaded, then it going to be application level.

You use the command LoadcustomUI in VBA. You can check out this command in
the help. Just remember to give the actual ribbon name you're going to load
the same as what you've specified in the access "Current database" options.

it's not clear if you're trying to change the room and that displays for
different users when they launch the application, or you simply won a
different ribbon for you the developer and what your users see?

However if you just wanting to display different ribbons for different forms
that are loaded, then I suggest you just use the ribbons property in the
form's other tab of the property sheet as this turns out to be less coding.

On the other hand if there's just a few different options that you want to
enabled or disabled to display for particular users, then I suggest that you
use code to "disable" or "enable" the particular options on your custom
ribbon. This is less work in the long run and it saves you from having to
maintains several copies of what essentially should be the same ribbon just
because you have a couple of options that are to be enabled, or disabled.


--
Albert D. Kallal (Access MVP)
Edmonton, Alberta Canada
pleaseNOO...@msn.com


Ray

unread,
May 29, 2009, 11:57:00 AM5/29/09
to
Hi,

Thanks for your response. I realize that the application level ribbon can
be set in the options. But is there a way to do that via code instead?

We are getting ready to move from Office 2003 to Office 2007. We have about
40 Access applications that will all be using a specific custom ribbon. I'll
be pasting some code into our standard startup routine that loads a custom
ribbon. It would be nice to be able to just add a couple extra lines of code
to apply that ribbon at the application level instead of having to set each
individually in the options.

We can change most other application level settings via code. The ability
to interact with the ribbon object in a similar manner doesn't seem like such
an unusual expectation.

Ray

unread,
Jun 18, 2009, 5:30:01 PM6/18/09
to
Well...I figured out the answer. And it's even smart enough to tell the
difference between access 2003 and 2007. Create a module with the following
3 functions/procedures:

Add a call to InitApp to the autoexec macro. It checks the version of
Access and calls the LoadRibbon procedure if version 2007 or higher.
LoadRibbon, loads the blank (or custom) ribbon. Finally, it checks to see if
the current project property CustomRibbonID exists. If it doesn't, then it
adds it, otherwise it sets it to the name of the newly added custom ribbon.
Presto...no ribbon.

Public Function InitApp()
On Error GoTo Err_InitApp
' This function is called as the first action in the autoexec macro. If
the version of office is
' 2007 or higher, then it calls a procedure to load a custom ribbon.
' Important: The actual command to load the ribbon will generate an
error in office 2003. To prevent
' the error it must be in a separate procedure that only gets called for
office 2007.

If Application.Version >= 12 Then
LoadRibbon
End If

Exit_InitApp:
Exit Function

Err_InitApp:
MsgBox "Function=InitApp" & vbcrlf & "Err#=" & Err & " " & Error$
Resume Exit_InitApp
End Function

Public Sub LoadRibbon()
On Error GoTo Err_LoadRibbon
Dim S As String
Const RibbonName = "No_Ribbon"
Const RibbonProp = "CustomRibbonID"

' This is a custom ribbon defined in XML that removes as much of the
ribbon as possible
S = "<customUI
xmlns=""http://schemas.microsoft.com/office/2006/01/customui"">" & vbcrlf & _
" <ribbon startFromScratch=""true"">" & vbcrlf & _
" <officeMenu>" & vbcrlf & _
" <button idMso=""FileOpenDatabase"" visible=""false"" />"
& vbcrlf & _
" <button idMso=""FileNewDatabase"" visible=""false"" />" &
vbcrlf & _
" <button idMso=""FileCloseDatabase"" visible=""false"" />"
& vbcrlf & _
" </officeMenu>" & vbcrlf & _
" </ribbon>" & vbcrlf & _
"</customUI>"

' This actually loads the ribbon.
' Note: this command does not exist in Access 2003. Just having it in
a procedure called
' under Access 2003 will generate an error under 2003. Using an if
statement so it doesn't
' get executed will not help. It must be in a separate procedure where
the entire procedure
' is only called under 2007.
Application.LoadCustomUI RibbonName, S

' And this will apply the ribbon if it's not already set
If Not DoesPropertyExist(RibbonProp) Then
CurrentProject.Properties.Add RibbonProp, RibbonName
ElseIf CurrentProject.Properties.Item(RibbonProp) <> RibbonName Then
CurrentProject.Properties.Item(RibbonProp) = RibbonName
End If

Exit_LoadRibbon:
Exit Sub

Err_LoadRibbon:
MsgBox "Sub=LoadRibbon" & vbcrlf & "Err#=" & Err & " " & Error$
Resume Exit_LoadRibbon
End Sub

Private Function DoesPropertyExist(Name As String) As Boolean
' This just loops through the properties to see if the specified one
exists
Dim I As Integer
Dim RetVal As Boolean

RetVal = False

For I = 0 To CurrentProject.Properties.Count - 1
If CurrentProject.Properties.Item(I).Name = Name Then
RetVal = True
Exit For
End If
Next

DoesPropertyExist = RetVal
End Function

gael

unread,
Jul 20, 2009, 9:36:28 AM7/20/09
to

"Ray" <R...@discussions.microsoft.com> a �crit dans le message de groupe de
discussion : 1AF93DEC-2496-46CD...@microsoft.com...

gael

unread,
Jul 23, 2009, 4:42:13 AM7/23/09
to

"gael" <carnac@yhlirelive> a ?crit dans le message de groupe de discussion :
...
>
> "Ray" <R...@discussions.microsoft.com> a ๏ฟฝcrit dans le message de groupe de
>>>oui date oui

lol

unread,
Jul 23, 2009, 6:15:13 PM7/23/09
to

--
?

lenny...@optonline.net

unread,
Jul 30, 2009, 2:58:22 AM7/30/09
to
yes

"gael" <carnac@yhlirelive> wrote in message
news:u8Wmf$3CKHA...@TK2MSFTNGP03.phx.gbl...

lol

unread,
Aug 10, 2009, 5:25:26 PM8/10/09
to
I wanna believe but I'm having a hard time seeing pass what I see right now
I see you right now I wanna be free but when I try fly I realize that I
don't know how no one showed me how. My faith is almost gone I can't hold on
much longer take this cup from me..........
Help me believe, can I believe, help me believe I wanna believe I'm no good
on my own please give me another chance its hard to believe in what I can't
see top give you my will for your what better for me Jesus look in my eyes
and see I wanna believe.

MY SASY GIRL

unread,
Sep 6, 2009, 4:10:32 PM9/6/09
to

"Ray" <R...@discussions.microsoft.com> wrote in message
news:9A3952BD-5807-4A12...@microsoft.com...

williams

unread,
Sep 14, 2009, 11:40:44 AM9/14/09
to

"Ray" <R...@discussions.microsoft.com> escribió en el mensaje de noticias
news:9A3952BD-5807-4A12...@microsoft.com...

ken

unread,
Sep 17, 2009, 10:26:31 AM9/17/09
to
Thank-you

"gael" <carnac@yhlirelive> wrote in message
news:u60iKZHC...@TK2MSFTNGP02.phx.gbl...

spook11

unread,
Oct 18, 2009, 12:44:53 AM10/18/09
to

"gael" <carnac@yhlirelive> wrote in message

news:u8Wmf$3CKHA...@TK2MSFTNGP03.phx.gbl...

Cudz

unread,
Nov 3, 2009, 8:13:03 PM11/3/09
to
Need help with Ribbon in the new MS Office 2007: HOW CAN I TURN OFF RIBBON
ALTOGETHER. I HATE THE RIBBON.HOW CAN I MAKE TOOLBARS LIKE I HAD IN MS OFFICE
2003. HATE HATE HATE RIBBON! PLEASE CAN ANYONE HELP?

Douglas J. Steele

unread,
Nov 5, 2009, 5:48:57 PM11/5/09
to
You can't, at least, not without buying tools from third parts that create
custom ribbons that resemble menus.

Incidentally, posting in upper case is the visual equivalent of shouting,
and is considered to be rude.

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)


"Cudz" <Cu...@discussions.microsoft.com> wrote in message
news:0EF1029D-6D96-4F61...@microsoft.com...

Kriter01

unread,
Nov 29, 2009, 11:38:01 PM11/29/09
to
Hello all,

I too am anything but impressed with the "ribbon" in the new iteration of MS
Office.
Everyone in my office group, my peers and my family clearly understood how
to get their work done. Now I am overwhelmed with questions relating to the
"look" and "feel" regarding "Oh shoot... how do I do it now?" questions
which is taking away from those duties for which I am paid for and held
accountable to perform.

Let me put this tactfully. I am paying a fee for the privilege to use a
product you (Microsoft) designed which proportedly will make my life / job
easier. The inability to revert to the 2003 vintage GUIs at the USER lever
is NOT a benefit I am willing to pay anything for.

Regarding Cudz's opinions below. You suggest that his using upper case text
is rude yet Microsoft can turn its customer's GUI world upside down without
good reason then lend a deaf ear to their after-market concerns? Without
even the pretense of "oops.. sorry guys, we'll fix that right a way?" Just
so you know sir, I'm whispering...

You are not helping the situation by suggesting the user fix their GUI woes
theirself by sending us/them to third party vendors who, for a nominal fee,
will provide us lowly users a "cure" for your boo-boo... which we've already
paid a hefty price for to start with??? I expected better product
development and after-sales support from you guys than this. I am
disappointed.

You salted the stew. You eat it.

As for me and mine, we're off to see about a slice of Apple pie.

Rick Kritikos
Just a dumb old hic user...


"Douglas J. Steele" wrote:

> .
>

Douglas J. Steele

unread,
Nov 30, 2009, 5:16:28 PM11/30/09
to
Just so you know, I do not work for Microsoft, nor do most of the responders
in these newsgroups. We're unpaid volunteers, and these newsgroups are
intended for peer-to-peer support, not for direct communication with
Microsoft.

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)


"Kriter01" <Krit...@discussions.microsoft.com> wrote in message
news:91EC197E-0191-48DD...@microsoft.com...

jose

unread,
Jan 24, 2010, 5:27:45 PM1/24/10
to
THAT HAPPEND TO ME ALREADY I DON'T KNOW BUT TRY THIS GO TO TOOLS AND FIND
SOMETHINGN ABOUT ribbons some sort like that

"Cudz" <Cu...@discussions.microsoft.com> wrote in message
news:0EF1029D-6D96-4F61...@microsoft.com...

aleta

unread,
Mar 27, 2010, 4:39:16 PM3/27/10
to

"jose" <JOSEMAJ...@LIVE.COM> wrote in message
news:AA8C809B-E9B3-4C34...@microsoft.com...

michaelbradley

unread,
Mar 30, 2010, 8:50:55 AM3/30/10
to

"jose" <JOSEMAJ...@LIVE.COM> wrote in message
news:AA8C809B-E9B3-4C34...@microsoft.com...
0 new messages