Ribbon bar not loading correctly (1 Viewer)

syvers

New member
Local time
Today, 19:49
Joined
Nov 13, 2007
Messages
4
Hi

I am trying to get a blank ribbon to be in place when a user opens my application. I have an Adp linked to SQL Server. If I create a table in SQL Server named ribbons and have the app read the data in that table in the AutoExec macro (this runs the code that reads the data) then assign the new ribbon to Application.LoadCustomUI RS("RibbonName").Value, RS("RibbonXml").Value it works and the blank ribbon is displayed. The problem is that this is no use because if the adp is not connected to the database on startup it causes an error as no connection has been established.

Instead I have put exactly the same xml file into a module but this does not have the same affect even though I call the same Application.LoadCustomUI method. I havent really done anything different except change how the xml is found. The problem with this method is it just pops the new ribbon into the list of available ribbons so then the user would have to choose the ribbon, shut down and restart, that is no use.

Has anybody got any idea what can be done about this? I will post the code below.

Thank you for any advice on what can be done.

Paul


First method (which works but is no good for distributing the app)

Autoexec calls the following
Public Function LoadRibbons()
Dim RS As Recordset
Set RS = CurrentProject.Connection.Execute("SELECT Ribbons.RibbonName, Ribbons.RibbonXML FROM RIBBONS")
If Not RS.BOF Then
Application.LoadCustomUI RS("RibbonName").Value, RS("RibbonXml").Value
End If
RS.Close
Set RS = Nothing
End Function

but using the following and calling it in autoexec just puts the ribbon in the list and doesnt use it

Function CreateRibbon()
Dim xml As String
xml = _
"<customUI xmlns=""http://schemas.microsoft.com/office/2006/01/customui"">" & vbCrLf & _
" <ribbon startFromScratch=""true"">" & vbCrLf & _
" <officeMenu>" & vbCrLf & _
" <button idMso=""FileCompactAndRepairDatabase"" visible=""false""/>" & vbCrLf & _
" <button idMso=""FileOpenDatabase"" visible=""false""/>" & vbCrLf & _
" <button idMso=""FileNewDatabase"" visible=""false""/>" & vbCrLf & _
" <splitButton idMso=""FileSaveAsMenuAccess"" visible=""false""/>" & vbCrLf & _
" </officeMenu>" & vbCrLf & _
" </ribbon>" & vbCrLf & _
"</customUI>"
Application.LoadCustomUI "BlankRibbon", xml
End Function
 

syvers

New member
Local time
Today, 19:49
Joined
Nov 13, 2007
Messages
4
After days of experimenting I have got the answer what it does mention in the help files on the ribbon bar is that if you are doing it with xml in a module then you MUST state the ribbon for every form whereas with the table method it would appear you dont need to bother.
 

Users who are viewing this thread

Top Bottom