2013-08-20 91 views
1

我試圖在OneNote中自動添加指向報告的鏈接。基本上,我有一個已經運行的宏,在VBA Excel中生成每日報告,並將值保存在給定文件夾中。現在我想添加到代碼中,以便在OneNote中創建超鏈接,以便最終用戶可以通過超鏈接訪問僅限值的文件。從VBA Excel更新OneNote

我發現了一塊VBA代碼在微軟網頁上的筆記本電腦創造了新的一頁:Create New Page

我已經修改了代碼,以便它會去到筆記本電腦,部分,然後我頁告訴它。然後我可以讓VBA通過XML格式獲取PageContent。

現在是這樣的事情:我有一個表,只開始一行兩列即月。標題(報告日期和鏈接)。現在我每天都要在寫一天的日期和鏈接之前在該表中添加一行。

我如何在OneNote中使用VBA Excel來做到這一點?可能嗎 ?或者我需要更改爲VB或C#才能使用Office-InterOp來完成此操作?

如果我設法創建一個額外的行,我想我沒有問題找到兩個空單元格和寫日期和超鏈接。

有人可以幫忙嗎?

感謝 塞巴斯蒂安

回答

0

後你會得到XML格式的網頁內容,你只需要修改它以包括表(或添加新的行/細胞,然後調用UpdatePageContent。這裏是一個示例頁面具有簡單表的XML:

<one:Page xmlns:one="http://schemas.microsoft.com/office/onenote/2010/onenote"> 
    <one:Outline> 
    <one:OEChildren> 
     <one:OE> 
     <one:Table> 
      <one:Row> 
      <one:Cell> 
       <one:OEChildren> 
       <one:OE><one:T><![CDATA[Cell1]]></one:T></one:OE> 
       </one:OEChildren> 
      </one:Cell> 
      <one:Cell> 
       <one:OEChildren> 
       <one:OE><one:T><![CDATA[Cell2]]></one:T></one:OE> 
       </one:OEChildren> 
      </one:Cell> 
      </one:Row> 
      <one:Row> 
      <one:Cell> 
       <one:OEChildren> 
       <one:OE><one:T><![CDATA[Cell3]]></one:T></one:OE> 
       </one:OEChildren> 
      </one:Cell> 
      <one:Cell> 
       <one:OEChildren> 
       <one:OE><one:T><![CDATA[Cell4]]></one:T></one:OE> 
       </one:OEChildren> 
      </one:Cell> 
      </one:Row> 
     </one:Table> 
     </one:OE> 
    </one:OEChildren> 
    </one:Outline> 
</one:Page>