简体   繁体   中英

xml in ms access 2007

I'm trying to add ribbons in ms access 2007 by creating USysRibbons and adding xml code in it:

Here is my code:

 <customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui"    onLoad="MyOnLoad"> 
 <ribbon startFromScratch="false"> <tabs> <tab id="Tab1" 
 label="My Tabs"    insertAfterMso="TabDatabaseTools">
 <group id="Group1" label="Buchbeispiel Gruppe"  supertip="Hier ist der ScreenTip"><menu id="Menu1" label="My First Menu"  itemSize="normal">
<button id="button1" label="Normal Button" imageMso="Risks" />
<toggleButton id="toggleButton1" label="A toggle Button" /><button id="button2" label="Click me" onAction="OnButtonClick" />
<menu id="menu2" label="Under menu" itemSize="large" ><button id="button3" label="Click the button3" imageMso="FormatPainter"  onAction="OnButtonClick" />
<button id="button4" label="Normal Button" imageMso="Risks" />
<menuSeparator id="sep2" title="Separator mit Text" />
<toggleButton id="toogleButton2" imageMso="HappyFace" 
label="A toggle Button"  description="Hiermit lassen sich Optionen auswahlen"/>
</menu>
</menu>
</group>
</tab>
<tab id="Tab2" label="My Second Tab" insertAfterMso="Tab1">
<group id="Group2" label="Example 2" supertip="Hier ist der ScreenTip">
</group>
</tab>
</tabs>
</ribbon>
</customUI>

But if I tried to add the tab id "Tab2" insert after Tab1 I'm getting an error:

    Error found in CUSTOM UI XML of C:\….Line 2Column 
    33ErrorCode 0X80004005Unknown   Office control ID: Tab1

What if I create another Tab and I want to insert it after my own tab, where can I get the control ID?

Thanks

If you don't add one group after a particular tab, then all of your groups will simply fall one after another.

Since you are forcing the position of one group, then you have to reference an ISO id. I don't believe you can reference your assigned Tab ID. There also a few other compile errors in your xml.

The solution is to simply insert your 2nd tab 1st using the isoID, and then insert your 1st group. Here is your xml with some syntax errors corrected:

<customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui"
   onLoad="MyOnLoad">
 <ribbon startFromScratch="false">

<tabs>

   <tab id="Tab2" label="My Second Tab" insertAfterMso="TabDatabaseTools">
      <group id="Group2" label="Example 2" supertip="Hier ist der ScreenTip">
      </group>
   </tab>

   <tab id="Tab1"  label="My Tabs"    insertAfterMso="TabDatabaseTools">
      <group id="Group1" label="Buchbeispiel Gruppe"  supertip="Hier ist der ScreenTip">
         <menu id="Menu1" label="My First Menu"  itemSize="normal">
            <button id="button1" label="Normal Button" imageMso="Risks" />
            <toggleButton id="toggleButton1" label="A toggle Button" />
            <button id="button2" label="Click me" onAction="OnButtonClick" />
         </menu>
         <menu id="menu2" label="Under menu" itemSize="large" >
            <button id="button3" label="Click the button3" 
               imageMso="FormatPainter"  onAction="OnButtonClick"/>
            <button id="button4" label="Normal Button" imageMso="Risks" />

            <menuSeparator id="sep2" title="Separator mit Text" />

            <toggleButton id="toogleButton2" imageMso="HappyFace"
               label="A toggle Button"
               description="Hiermit lassen sich Optionen auswahlen"/>
         </menu>

      </group>
   </tab>


</tabs>
</ribbon>
</customUI>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM