XML用于自定义MS Access功能区,带有多个选项卡
我正在尝试创建带有多个选项卡的功能区 这是我拥有的代码,它不起作用,没有错误(除了VBA在启动时开放,我假设幕后发生了一些不喜欢的事情),但是工具栏不存在,我可以定期访问工具栏
这是一个测试工具栏,所以我要重复按钮等。我在访问中编写了一个小应用程序,该应用程序根据应用程序中的选择盖章XML,并且正在测试它。该应用程序适用于具有1个选项卡的工具栏,但对于多个选项卡 - 没有运气
<?xml version="1.0" encoding="utf-8"?>
<customUI
xmlns="http://schemas.microsoft.com/office/2006/01/customui" onLoad="OnLoadRibbon" loadImage="OnLoadImage">
<ribbon startFromScratch="true">
<tabs>
<tab id="tabMain" label="Kroka">
<group id="grpAppOptions" label="App Options">
<button id="btnLock" label="Lock Database" onAction="macLock" getImage="FGetRibbonImages" size="large"/>
<button id="btnPublishFile" label="Publish File" onAction="macPublishFile" getImage="FGetRibbonImages" size="large"/>
<button id="btnAdmin" label="Admin Settings" onAction="macAdmin" getImage="FGetRibbonImages" size="large"/>
<button id="btnExit" label="Exit App" onAction="macExit" getImage="FGetRibbonImages" size="large"/>
</group>
<group id="grpReports" label="Reports">
<button id="btnCloseReport" label="Close Report" onAction="macCloseReport" getImage="FGetRibbonImages" size="large"/>
<button id="btnExit" label="Exit App" onAction="macExit" getImage="FGetRibbonImages" size="large"/>
</group>
</tab>
<tab id="tabTest" label="Kroka2">
<group id="grpAppOptions" label="App Options">
<button id="btnSubmitIdea" label="Submit Idea" onAction="macCustomers" getImage="FGetRibbonImages" size="large"/>
<button id="btnPublishFile" label="Publish File" onAction="macPublishFile" getImage="FGetRibbonImages" size="large"/>
<button id="btnCustomers" label="Customers" onAction="macCustomers" getImage="FGetRibbonImages" size="large"/>
<button id="btnExit" label="Exit App" onAction="macExit" getImage="FGetRibbonImages" size="large"/>
</group>
<group id="grpReports" label="Reports">
<button id="btnCloseReport" label="Close Report" onAction="macCloseReport" getImage="FGetRibbonImages" size="large"/>
<button id="btnExit" label="Exit App" onAction="macExit" getImage="FGetRibbonImages" size="large"/>
</group>
</tab>
</tabs>
</ribbon>
</customUI>
I'm trying to create a ribbon with multiple tabs for an app
This is the code I have and it's not working, no errors (except that VBA opens on startup, I'm assuming something IS happening behind the scenes that it's not liking), but the toolbar isn't there, I get the regular Access toolbar
This is a test toolbar, so I'm repeating buttons, etc. I wrote a little app in access that stamps the XML based on choices made in the app and I was testing it out. The app works fine for toolbars with 1 tab but for multiple tabs - no luck
<?xml version="1.0" encoding="utf-8"?>
<customUI
xmlns="http://schemas.microsoft.com/office/2006/01/customui" onLoad="OnLoadRibbon" loadImage="OnLoadImage">
<ribbon startFromScratch="true">
<tabs>
<tab id="tabMain" label="Kroka">
<group id="grpAppOptions" label="App Options">
<button id="btnLock" label="Lock Database" onAction="macLock" getImage="FGetRibbonImages" size="large"/>
<button id="btnPublishFile" label="Publish File" onAction="macPublishFile" getImage="FGetRibbonImages" size="large"/>
<button id="btnAdmin" label="Admin Settings" onAction="macAdmin" getImage="FGetRibbonImages" size="large"/>
<button id="btnExit" label="Exit App" onAction="macExit" getImage="FGetRibbonImages" size="large"/>
</group>
<group id="grpReports" label="Reports">
<button id="btnCloseReport" label="Close Report" onAction="macCloseReport" getImage="FGetRibbonImages" size="large"/>
<button id="btnExit" label="Exit App" onAction="macExit" getImage="FGetRibbonImages" size="large"/>
</group>
</tab>
<tab id="tabTest" label="Kroka2">
<group id="grpAppOptions" label="App Options">
<button id="btnSubmitIdea" label="Submit Idea" onAction="macCustomers" getImage="FGetRibbonImages" size="large"/>
<button id="btnPublishFile" label="Publish File" onAction="macPublishFile" getImage="FGetRibbonImages" size="large"/>
<button id="btnCustomers" label="Customers" onAction="macCustomers" getImage="FGetRibbonImages" size="large"/>
<button id="btnExit" label="Exit App" onAction="macExit" getImage="FGetRibbonImages" size="large"/>
</group>
<group id="grpReports" label="Reports">
<button id="btnCloseReport" label="Close Report" onAction="macCloseReport" getImage="FGetRibbonImages" size="large"/>
<button id="btnExit" label="Exit App" onAction="macExit" getImage="FGetRibbonImages" size="large"/>
</group>
</tab>
</tabs>
</ribbon>
</customUI>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
ID应该是唯一的。但是它们在您的功能区XML标记中的两个选项卡上都重复了。
默认情况下,如果加载程序尝试操纵Microsoft Office用户界面(UI)并失败,则不会显示错误消息。但是,您可以配置Microsoft Office应用程序以显示与UI相关的错误的消息。您可以使用这些消息来帮助确定为什么未出现自定义功能区,或者为什么出现色带,但没有显示控件。在如何:显示加载程序用户界面错误文章。
IDs should be unique. But they are duplicated on both tabs in your ribbon XML markup.
By default, if an add-in attempts to manipulate the Microsoft Office user interface (UI) and fails, no error message is displayed. However, you can configure Microsoft Office applications to display messages for errors that relate to the UI. You can use these messages to help determine why a custom ribbon does not appear, or why a ribbon appears but no controls appear. Read more about that in the How to: Show Add-in user interface errors article.