Ribbon code

pirseinkim

Registered User.
Local time
Yesterday, 21:31
Joined
Apr 27, 2012
Messages
10
I have created an xml file in Microsoft visual web developer for my ribbon. Then I copied and pasted it into the USysRibbons table in access 2010 in the RibbonXML field. My xml file is pretty lengthy. I went in to add about 7 more lines to show under my report button but I get this error:
'The text is too long to be edited". Once I remove those lines of code, it will copy & paste successfully. Is there a limit of how many lines I can have? I know that there is no syntax error because it complies fine and it's basically copying the other lines, just changing the names of criteria.

Any help is greatly appreciated.

Kim P
 
Btw - the RibbonXML field is a memo field so I guess it does have a limitation of 65,536 characters. Is there a way to expand that? Seems like there would be a way since I know that excel, access and word's ribbons are much larger than what I am working with.
 
I was searching for a solution for this also, and I finally came up with one based on the limits detailed here (I can't post links - add the http part): office.microsoft.com/client/helppreview14.aspx?AssetId=HV080211391&lcid=1033&NS=MSACCESS%2EDEV&Version=14&tl=2&CTT=4

As long as you meet the specified conditions, the RibbonXML Memo field is limited only by the size of the database. Here's my code (it's not for users, just me, so nothing fancy - replace the filename and RibbonName with yours and hit F5):

Code:
Private Sub LoadXMLFromFile()
Dim sBuf As String
Dim sTemp As String
Dim iFileNum As Integer
Dim db As DAO.Database
Dim rs As DAO.Recordset
    iFileNum = FreeFile
    Open "C:\Milkco\DMS\Current.xml" For Input As iFileNum
    Line Input #iFileNum, sBuf
    sTemp = Mid$(sBuf, 4)    'Remove the BOM
    Do Until EOF(iFileNum)
        Line Input #iFileNum, sBuf
        sTemp = sTemp & sBuf & vbCrLf
    Loop
    Close iFileNum
 
    Set db = CurrentDb
    Set rs = db.OpenRecordset("USysRibbons", dbOpenTable)
    Do While Not rs.EOF
        With rs
            If !RibbonName = "DMS" Then
                .Edit
                !Ribbonxml = sTemp
                .Update
                Exit Do
            End If
        End With
        rs.MoveNext
    Loop
    Set rs = Nothing
    Set db = Nothing
 
End Sub

Jonathan
 
Well, this was close, but apparently removing the leading BOM characters was not enough, as they showed up as trailing characters on some labels on dropdown menus.

So, I open the XML file in my XML editor (VS), select all, copy, paste it into Notepad and save it as a txt file. Comment out the 2 lines of code between Open and Do Until, change the filename to the text file, and now it works - no strange characters at the end of some labels. (You may or may not have this issue.)

I'd prefer it be more automated, but I don't change the menus that often, and it works, so it's not worth putting more time into it.

Jonathan
 
Thank you very much. I will try to work with this and see where it goes!!
 

Users who are viewing this thread

Back
Top Bottom