PublishObjects.Item property (Excel)

Returns a single object from a collection.

Syntax

expression.Item (Index)

expression A variable that represents a PublishObjects object.

Parameters

Name Required/Optional Data type Description
Index Required Variant The name or index number of the object.

Example

This example obtains the identifier from a <DIV> tag and finds the line in a webpage (q198.htm) that you saved from a workbook. The example then creates a copy of the webpage (newq1.htm) and inserts a comment line before the <DIV> tag in the copy of the file.

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

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.