Excel) (PublishObjects.Item 屬性

傳回集合中的單一物件。

語法

運算式。項目 (索引)

運算式 代表 PublishObjects 物件的變數。

參數

名稱 必要/選用 資料類型 描述
Index 必要 Variant 物件的名稱或索引編號。

範例

此範例會從標籤取得 <DIV> 識別碼,並尋找您從活頁簿儲存的網頁 (q198.htm) 中的這一行。 然後,範例會建立網頁 (newq1.htm) 的複本,並在檔案複本中的標籤前 <DIV> 插入註解行。

strTargetDivID = ActiveWorkbook.PublishObjects.Item(1).DivID 
Open "\\server1\reports\q198.htm" For Input As #1 
Open "\\server1\reports\newq1.htm" For Output As #2 
While Not EOF(1) 
 Line Input #1, strFileLine 
 If InStr(strFileLine, strTargetDivID) > 0 And _ 
 InStr(strFileLine, "<div") > 0 Then 
 Print #2, "<!--Saved item-->" 
 End If 
 Print #2, strFileLine 
Wend 
Close #2 
Close #1

支援和意見反應

有關於 Office VBA 或這份文件的問題或意見反應嗎? 如需取得支援服務並提供意見反應的相關指導,請參閱 Office VBA 支援與意見反應。