2013-03-26 84 views
1

Heyy 我一直在創建宏,然後將它們添加到excel(2010)上的自定義功能區。我有的問題是,每次我重命名原始文件(保存爲),我創建了宏和功能區,然後單擊功能區/宏,它會自動打開原始文件,以便在新的保存文件上工作。如果我從原始路徑中刪除文件,然後再次打開重命名的文件並使用功能區運行宏它不會運行它給我找不到錯誤文件。Excel Ribbon在文件重命名後不起作用

我已經出口定製的Ribbon UI,當我使用記事本打開它++我可以看到原始文件 的硬編碼路徑,反正是有解決這個?以每次我保存不同的名稱或在不同的路徑文件重命名這些綵帶....

回答

0

從這裏使用自定義用戶界面編輯器: http://openxmldeveloper.org/blog/b/openxmldeveloper/archive/2010/08/10/23248.aspx

有一個微軟蒞臨指導: 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 &amp; 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> 

希望這有助於