2015-07-21 91 views
0

我開發了一個超級用戶插件,它爲Excel中的圖表「斷開連接」重新創建圖表的源數據。所以我.SaveChartTemplate然後ApplyChartTemplate到一個新的圖表,並需要刪除溫度。模板。圖表模板文件夾

不知道如何獲取圖表模板文件夾。我假設它是Environ("AppData") & "\Microsoft\Шаблоны\Charts\",但很顯然它只適用於俄語區域設置。

回答

0

分析註冊表項之後,我認識到模板文件夾的名稱可以在HKCU\Software\Microsoft\Office\<OFFICE VERSION>\Common\General\Templates

Templates in registry

上述可能的解決方案假設發現是

Function chartTemplatesFolder() As String 
    On Error GoTo er: 
    Dim templatesFolder As String 
    templatesFolder = CreateObject("WScript.Shell").RegRead(_ 
     "HKCU\Software\Microsoft\Office\" & Application.Version & "\Common\General\Templates") 
    chartTemplatesFolder = Environ("AppData") & "\Microsoft\" & templatesFolder & "\Charts\" 
Exit Function 
er: 
End Function