473,395 Members | 2,443 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

AutoExec Not Loading Ribbon

124 100+
I have the following code in my AutoExec:

Expand|Select|Wrap|Line Numbers
  1.     Dim strRibbonName As String, strXML As String
  2.  
  3.     strRibbonName = "customUI"
  4.     strXML = "<customUI xmlns=""http://schemas.microsoft.com/office/2006/01/customui"">" _
  5.         & "<ribbon startFromScratch=""true"" /></customUI>"
  6.  
  7.     Application.LoadCustomUI strRibbonName, strXML
  8.  
However, when I open my db the Ribbon still displays. I'm using an ADP which is why I'm not using a USysRibbons table.
Sep 10 '10 #1
4 3601
Megalog
378 Expert 256MB
I've never had any luck implementing a ribbon through code.. My db is always picky and wants it to be called from a table.

But, everything looks in order except that the Ribbon tag may not be closed right.

Try:

Expand|Select|Wrap|Line Numbers
  1.     strXML = "<customUI xmlns=""http://schemas.microsoft.com/office/2006/01/customui"">" _ 
  2.         & "<ribbon startFromScratch=""true""></ribbon></customUI>" 
Sep 16 '10 #2
bullfrog83
124 100+
I found a way to load the ribbon from an xml file which I prefer. I call this function in my autoexec macro:

Expand|Select|Wrap|Line Numbers
  1. Public Function LoadRibbonsADP()
  2. On Error GoTo Error_Handler
  3.  
  4.     Dim strXMLPath As String
  5.     Dim strXMLData As String
  6.  
  7.     'get the path to the ribbon and make sure it exists
  8.     strXMLPath = CurrentProject.Path & "\customUI.xml"
  9.     Debug.Assert (Len(Dir(strXMLPath)) > 0)
  10.  
  11.     'load the ribbon from disk
  12.     Open strXMLPath For Input Access Read As #1
  13.     strXMLData = Input(LOF(1), 1)
  14.  
  15.     'remove the byte order mark
  16.     strXMLData = Mid(strXMLData, InStr(strXMLData, "<customUI"))
  17.     Close #1
  18.  
  19.     ' Check the command line. If you pass "DEBUG" to the /cmd switch, load the ribbon with startFromScratch="false"
  20.     If (Command$() = "DEBUG") Then
  21.         strXMLData = Replace(strXMLData, _
  22.                             "startFromScratch=""true""", _
  23.                             "startFromScratch=""false""")
  24.     End If
  25.  
  26.     LoadCustomUI "customUI", strXMLData
  27.  
  28. Exit_Procedure:
  29.     Exit Function
  30. Error_Handler:
  31.     MsgBox "Error " & Err.Number & ": " & Err.Description, vbCritical
  32.     Resume Exit_Procedure
  33. End Function
  34.  
Sep 16 '10 #3
Megalog
378 Expert 256MB
Excellent, thanks for posting a good working solution. Will be stealing this for my code archive right now =)
Sep 16 '10 #4
bullfrog83
124 100+
No problem! Keep in mind that this code works if your xml file is named customUI.xml. If it's named something else then you'll have to replace the "customUI" in the code with whatever you've named your file. I only have one ribbon in my db so customUI was good enough for me.
Sep 16 '10 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: mvivar | last post by:
Hi everybody: This will be not easy to explain as my mother language is not english, so my apologies in advance if it sounds confusing. We have a database access 97 wich controls time of...
6
by: MLH | last post by:
Did A97, perchance, do away with the need for an AutoExec macro to initiate an autoexec sequence for databases? Or, must we still suffer with that hideous macro?
5
by: dick | last post by:
I can't seem to get AutoExec to run a function. Per an article on this group, I: 1) built a boolean function in a module that simply issues a MsgBox, then returns True 2) in AutoExec macro, I...
7
by: denuk2003 | last post by:
Hi Everybody I have a 2003 application that I am trying to run under 2007, The code seems to work OK but the Ribbon is a big problem. It just takes up too much space away from the application. ...
10
by: Patrick Schmid [MVP] | last post by:
I have no idea what is going on... I took an add-in for Office 2007 that I started in VS 2003, and imported the whole thing into VS 2005. Then I added some custom .Net components from Developer...
3
by: Bill | last post by:
Can anyone direct me to a free office 2007 like ribbon bar
1
by: btsnyder | last post by:
I have a customized Ribbon for Access 2007 with various buttons that open different forms. When opening certain forms, none of which have their own custom ribbon assigned, the selected tab is reset...
0
by: ARC | last post by:
Well, maybe not interesting, more like hair-pulling. Ok, so if you want to code misc. utilities and forms for the office button (Like a registration screen, backup, setup options, connect to...
4
by: scubasteve | last post by:
Hi, I'm having issues with AC2007 custom ribbons. I'm building an AC2007 runtime app which has a custom ribbon (called CommandsDisabledHideRibbon) set as the default db ribbon name (see XML at...
4
by: Bob | last post by:
Hi, Can it's possible to use a customized QAT in Access 2007 with a Ribbon using "USysRibbons" ? because in Access options i can't select 2 ribbon name. Thank's
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.