Heyy 我一直在创建宏,然后将它们添加到excel(2010)上的自定义色带上。我遇到的问题是,每次我重命名原始文件(另存为),我创建了宏和功能区,然后单击功能区/宏它会自动打开原始文件,使其在新的保存为文件时工作。如果我从原始路径中删除文件然后再次打开重命名的文件并使用功能区运行宏它不运行它会给我找不到错误文件。
我已导出自定义功能区ui,当我使用记事本++打开它时,我可以看到原始文件的硬编码路径 无论如何要解决这个问题?每次我用不同的名字或不同的路径保存文件时重命名这些丝带....
答案 0 :(得分:0)
使用此处的自定义UI编辑器: http://openxmldeveloper.org/blog/b/openxmldeveloper/archive/2010/08/10/23248.aspx
这里有一个Microsoft指南: http://msdn.microsoft.com/en-us/library/ee691832(v=office.14).aspx
在对宏和色带进行实际编码时,请避免对名称进行硬编码,它将完美运行。以下是我在我的一个宏文件中使用的代码示例:
<?xml version="1.0" encoding="utf-8"?>
<customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui">
<ribbon>
<tabs>
<tab id="refunds" label="Refunds/Returns" >
<group id="financeRefund" label="Refunds & Returns" >
<button id="refresh" visible="true" size="large"
label="Refresh Front Page" keytip="R"
screentip="Refresh the frontpage without clearing the data in the data sheet."
onAction="refreshfp" imageMso="RecurrenceEdit" />
<button id="new" visible="true" size="large"
label="Update Data" keytip="S"
screentip="Pulls in new data from the live sheet, clearing any changes made to the current data sheet."
onAction="updateData"
imageMso="ExportSharePointList" />
</group>
</tab>
</tabs>
</ribbon>
</customUI>
希望这有帮助