dbTalk Databases Forums  

loading a custom ribbon in access2010

comp.databases.ms-access comp.databases.ms-access


Discuss loading a custom ribbon in access2010 in the comp.databases.ms-access forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Roger
 
Posts: n/a

Default loading a custom ribbon in access2010 - 08-30-2011 , 05:04 AM






the following is used in access2007 (mdb) and it successfully loads a
QAT ribbon
the same function runs, without error, in access2010 (accdb), but
the new ribbon is not shown, and the original ribbon is not hidden

if I step through and re-execute
Application.LoadCustomUI "ASCA", strOut

a second time, I get this error
cannot load customization 'asca'
this customization name was already loaded

which seems to confirm that there is no error with the customization

do I need to do something extra in access2010 to display the ribbon ?


Option Compare Database
Option Explicit

Public Function loadRibbon()
Dim f As Long
Dim strText As String
Dim strOut As String
Dim strFile As String

On Error GoTo fErr
f = FreeFile
strFile = "c:\asca\"
Open strFile & "ribbon.xml" For Input As f
strOut = ""
Do While Not EOF(f)
Line Input #f, strText
strOut = strOut & strText
Loop

Application.LoadCustomUI "ASCA", strOut
fExit:
On Error Resume Next
Close f
Exit Function

fErr:
Select Case Err
Case 32609
' Ribbon already loaded
Resume Next
Case Else
errorLog "loadRibbon " & Err.Description
End Select

Resume fExit
End Function



ribbon.xml is
- <customUI xmlns="http://schemas.microsoft.com/office/2006/01/
customui">
- <!-- http://www.accessribbon.de/en/index.php
-->
- <ribbon startFromScratch="true">
- <qat>
- <documentControls>
<button idMso="FileSave" />
<button idMso="Copy" />
<button idMso="Paste" />
<button idMso="PrintDialogAccess" />
<button idMso="PrintPreviewClose" />
<button idMso="FilterBySelection" />
<button idMso="ApplyFilter" />
<button idMso="AdpOutputOperationsSortAscending" />
<button idMso="AdpOutputOperationsSortDescending" />
<button idMso="ExportExcel" />
<button idMso="ExportWord" />
<button idMso="SpellingAccess" />
<button idMso="WindowsCascade" />
<button idMso="FileExit" />
</documentControls>
</qat>
</ribbon>
</customUI>

Reply With Quote
  #2  
Old   
Roger
 
Posts: n/a

Default Re: loading a custom ribbon in access2010 - 09-01-2011 , 10:23 PM






On Aug 30, 4:04*am, Roger <lesperan... (AT) natpro (DOT) com> wrote:
Quote:
the following is used in access2007 (mdb) and it successfully loads a
QAT ribbon
the same function runs, without error, in access2010 (accdb), but
the new ribbon is not shown, and the original ribbon is not hidden

if I step through and re-execute
* * * *Application.LoadCustomUI "ASCA", strOut

a second time, I get this error
* cannot load customization 'asca'
* this customization name was already loaded

which seems to confirm that there is no error with the customization

do I need to do something extra in access2010 to display the ribbon ?

Option Compare Database
Option Explicit

Public Function loadRibbon()
* * Dim f As Long
* * Dim strText As String
* * Dim strOut As String
* * Dim strFile As String

* * On Error GoTo fErr
* * f = FreeFile
* * strFile = "c:\asca\"
* * Open strFile & "ribbon.xml" For Input As f
* * strOut = ""
* * Do While Not EOF(f)
* * * * Line Input #f, strText
* * * * strOut = strOut & strText
* * Loop

* * Application.LoadCustomUI "ASCA", strOut
fExit:
* * On Error Resume Next
* * Close f
* * Exit Function

fErr:
* * Select Case Err
* * * * Case 32609
* * * * ' Ribbon already loaded
* * * * Resume Next
* * Case Else
* * * * errorLog "loadRibbon " & Err.Description
* * End Select

* * Resume fExit
End Function

ribbon.xml is
- <customUI xmlns="http://schemas.microsoft.com/office/2006/01/
customui"
- <!-- *http://www.accessribbon.de/en/index.php
* --
- <ribbon startFromScratch="true"
- <qat
- <documentControls
* <button idMso="FileSave" /
* <button idMso="Copy" /
* <button idMso="Paste" /
* <button idMso="PrintDialogAccess" /
* <button idMso="PrintPreviewClose" /
* <button idMso="FilterBySelection" /
* <button idMso="ApplyFilter" /
* <button idMso="AdpOutputOperationsSortAscending" /
* <button idMso="AdpOutputOperationsSortDescending" /
* <button idMso="ExportExcel" /
* <button idMso="ExportWord" /
* <button idMso="SpellingAccess" /
* <button idMso="WindowsCascade" /
* <button idMso="FileExit" /
* </documentControls
* </qat
* </ribbon
* </customUI
if I uncheck 'allow full menus' and 'allow default shortcut menus'
under options->current database
the load custom function loads my qat ribbon
but there is also a file menu with 'print', 'privacy options' and
'exit'
privacy options allow the user to recheck the options above

I've tried different suggestions, but can't get to turn off the
'privacy options'
this is what I've got so far, before loading my QAT ribbon

Dim db As DAO.Database
Dim strMsg As String

On Error GoTo fErr
Set db = CurrentDb
DoCmd.NavigateTo "acNavigationCategoryObjectType"
DoCmd.RunCommand acCmdWindowHide

Call SetPropertyDAO(db, "allowFullMenus", dbBoolean, False,
strMsg)
Call SetPropertyDAO(db, "allowDefaultShortcutMenus", dbBoolean,
False, strMsg)

Reply With Quote
Reply




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 On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.