Excel:自定义功能区模板(XLSTART)

时间:2019-04-17 10:55:34

标签: excel templates ribbon

我为Excel 功能区创建了一个自定义标签,它具有单个组和一个按钮。该文件另存为XLSM文件,并且在打开时按预期工作。

我希望自定义标签显示为每当打开excel文档时显示。 XLSM文件保存在XLSTART文件夹中,并在打开任何Excel文档时启动。问题是打开了两个文档,带有自定义选项卡的XLSM和仅带有标准功能区的单击文件。

我认为这很正常,因为它被认为是单独的文件而不是模板;但是如果文件另存为模板(经过XLTX和XLTM的测试), Excel根本不会读取它

  • 双击模板会打开它(问题是使其自动启动)
  • 仅当XLSTART中的文档是模板时,问题才会出现
  • 模板中的引用以正确的语言编写
  • 已经在不同的机器上进行了测试
  • 我正在使用Excel 2016(32位)

这个想法是向需要在“自定义”选项卡中使用该工具的每个用户提供此模板,而无需创建安装可执行文件(在我们的环境中被阻止)并使用excel自动启动。

您是否遇到过此问题,或者知道我可能错过的一些事情?

CustomUi14.xml

<customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui" onL`oad="OnRibbonLoad">
  <ribbon>
    <tabs>
      <tab id="tab0" label="NUEVOVI Tools">
        <group id="grp0" autoScale="true" centerVertically="false" label="Any365 Reports" getVisible ="GetVisible" tag = "RibbonName:=;inMenu:=;CustomTagValue1:=;CustomTagValue2:=;CustomTagValue3:=;CustomPicture:=;CustomPicturePath:=" >
          <button idMso="ChartInsert" showLabel="true" size="large" label="Generate" tag="RibbonName:=;inMenu:=;CustomTagValue1:=;CustomTagValue2:=;CustomTagValue3:=;CustomPicture:=;CustomPicturePath:=" onAction="generateReport" getVisible="GetVisible" getEnabled="GetEnabled" />
        </group>
      </tab>
    </tabs>
  </ribbon>
</customUI>

.rels文件

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"><Relationship Id="R7f19f805bfb641b9" Type="http://schemas.microsoft.com/office/2007/relationships/ui/extensibility"    Target="customUI/customUi14.xml"/><Relationship Id="rId3" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties" Target="docProps/app.xml"/><Relationship Id="rId2" Type="http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties" Target="docProps/core.xml"/><Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" Target="xl/workbook.xml"/></Relationships>

文件:http://s000.tinyupload.com/index.php?file_id=76809226544239420467

2 个答案:

答案 0 :(得分:0)

Configuring Excel

并尝试

<customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui" onLoad="OnRibbonLoad">
  <ribbon startFromScratch="false">
    <tabs>
      <tab id="tab0" label="NUEVOVI Tools" insertBeforeMso = "TabHome" keytip = "G">
        <group id="grp0" autoScale="true" centerVertically="false" label="Any365 Reports" getVisible ="GetVisible" tag = "RibbonName:=;inMenu:=;CustomTagValue1:=;CustomTagValue2:=;CustomTagValue3:=;CustomPicture:=;CustomPicturePath:=" >
          <button idMso="ChartInsert" showLabel="true" size="large" label="Generate" tag="RibbonName:=;inMenu:=;CustomTagValue1:=;CustomTagValue2:=;CustomTagValue3:=;CustomPicture:=;CustomPicturePath:=" onAction="generateReport" getVisible="GetVisible" getEnabled="GetEnabled" />
        </group>
      </tab>
    </tabs>
  </ribbon>
</customUI>

在某些安全性受到很多限制的网络上,您可能无权访问XLSTART目录,或者您没有权限保存文件。而是在您自己的系统上使用所需的任何名称创建启动目录,并将book.xltx文件存储在此新的备用启动目录中。选择的目录名称无关紧要,但是您需要告诉Excel它在哪里。

答案 1 :(得分:0)

通过将文件另存为XLAM 解决了该问题。这使它完美地工作。 出于某些(对我而言不为人所知)原因,模板文件没有从XLSTART forlder加载。