返回或设置由 Index 参数指定的调整值。对于线性调整,调整值 0.0 通常对应于图形的左边缘或上边缘,而值 1.0 通常对应于图形的右边缘或下边缘。但是,对于某些图形,调整可超过图形的边界。对于辐射调整,调整值 1.0 对应于图形的宽度。对于角度调整,调整值是以度为单位指定的。Item 属性仅应用于可调整的图形。Single 类型,可读写。
expression.Item(Index)
expression 必需。该表达式返回一个 Adjustments 对象。
Index Long 类型,必需。调整的索引号。
自选图形、连接符和艺术字对象最多可进行八次调整。
应用于 Areas、Filters、HPageBreaks、Panes、Phonetics、RecentFiles 和 VPageBreaks 对象的 Item 属性。
返回一个集合的单个对象。
expression.Item(Index)
expression 必需。该表达式返回上面的对象之一。
Index Long 类型,必需。对象的索引号。
返回一个 Border 对象,该对象代表单元格区域或样式的某一边框。
expression.Item(Index)
expression 必需。该表达式返回一个 Borders 集合。
Index XlBordersIndex 类型,必需。
| XlBordersIndex 可为以下 XlBordersIndex 常量之一。 | 
| xlDiagonalDown | 
| xlDiagonalUp | 
| xlEdgeBottom | 
| xlEdgeLeft | 
| xlEdgeRight | 
| xlEdgeTop | 
| xlInsideHorizontal | 
| xlInsideVertical | 
返回一个 Dialog 对象,该对象代表单个内置对话框。
expression.Item(Index)
expression 必需。该表达式返回一个 Dialogs 对象。
Index XlBuiltInDialog 类型,必需。
| XlBuiltInDialog 可为以下 XlBuiltInDialog 常量之一。 | 
| _xlDialogChartSourceData | 
| _xlDialogPhonetic | 
| xlDialogActivate | 
| xlDialogActiveCellFont | 
| xlDialogAddChartAutoformat | 
| xlDialogAddinManager | 
| xlDialogAlignment | 
| xlDialogApplyNames | 
| xlDialogApplyStyle | 
| xlDialogAppMove | 
| xlDialogAppSize | 
| xlDialogArrangeAll | 
| xlDialogAssignToObject | 
| xlDialogAssignToTool | 
| xlDialogAttachText | 
| xlDialogAttachToolbars | 
| xlDialogAutoCorrect | 
| xlDialogAxes | 
| xlDialogBorder | 
| xlDialogCalculation | 
| xlDialogCellProtection | 
| xlDialogChangeLink | 
| xlDialogChartAddData | 
| xlDialogChartLocation | 
| xlDialogChartOptionsDataLabelMultiple | 
| xlDialogChartOptionsDataLabels | 
| xlDialogChartOptionsDataTable | 
| xlDialogChartSourceData | 
| xlDialogChartTrend | 
| xlDialogChartType | 
| xlDialogChartWizard | 
| xlDialogCheckboxProperties | 
| xlDialogClear | 
| xlDialogColorPalette | 
| xlDialogColumnWidth | 
| xlDialogCombination | 
| xlDialogConditionalFormatting | 
| xlDialogConsolidate | 
| xlDialogCopyChart | 
| xlDialogCopyPicture | 
| xlDialogCreateNames | 
| xlDialogCreatePublisher | 
| xlDialogCustomizeToolbar | 
| xlDialogCustomViews | 
| xlDialogDataDelete | 
| xlDialogDataLabel | 
| xlDialogDataLabelMultiple | 
| xlDialogDataSeries | 
| xlDialogDataValidation | 
| xlDialogDefineName | 
| xlDialogDefineStyle | 
| xlDialogDeleteFormat | 
| xlDialogDeleteName | 
| xlDialogDemote | 
| xlDialogDisplay | 
| xlDialogEditboxProperties | 
| xlDialogEditColor | 
| xlDialogEditDelete | 
| xlDialogEditionOptions | 
| xlDialogEditSeries | 
| xlDialogErrorbarX | 
| xlDialogErrorbarY | 
| xlDialogErrorChecking | 
| xlDialogEvaluateFormula | 
| xlDialogExternalDataProperties | 
| xlDialogExtract | 
| xlDialogFileDelete | 
| xlDialogFileSharing | 
| xlDialogFillGroup | 
| xlDialogFillWorkgroup | 
| xlDialogFilter | 
| xlDialogFilterAdvanced | 
| xlDialogFindFile | 
| xlDialogFont | 
| xlDialogFontProperties | 
| xlDialogFormatAuto | 
| xlDialogFormatChart | 
| xlDialogFormatCharttype | 
| xlDialogFormatFont | 
| xlDialogFormatLegend | 
| xlDialogFormatMain | 
| xlDialogFormatMove | 
| xlDialogFormatNumber | 
| xlDialogFormatOverlay | 
| xlDialogFormatSize | 
| xlDialogFormatText | 
| xlDialogFormulaFind | 
| xlDialogFormulaGoto | 
| xlDialogFormulaReplace | 
| xlDialogFunctionWizard | 
| xlDialogGallery3dArea | 
| xlDialogGallery3dBar | 
| xlDialogGallery3dColumn | 
| xlDialogGallery3dLine | 
| xlDialogGallery3dPie | 
| xlDialogGallery3dSurface | 
| xlDialogGalleryArea | 
| xlDialogGalleryBar | 
| xlDialogGalleryColumn | 
| xlDialogGalleryCustom | 
| xlDialogGalleryDoughnut | 
| xlDialogGalleryLine | 
| xlDialogGalleryPie | 
| xlDialogGalleryRadar | 
| xlDialogGalleryScatter | 
| xlDialogGoalSeek | 
| xlDialogGridlines | 
| xlDialogImportTextFile | 
| xlDialogInsert | 
| xlDialogInsertHyperlink | 
| xlDialogInsertNameLabel | 
| xlDialogInsertObject | 
| xlDialogInsertPicture | 
| xlDialogInsertTitle | 
| xlDialogItemProperties | 
| xlDialogLabelProperties | 
| xlDialogListboxProperties | 
| xlDialogMacroOptions | 
| xlDialogMailEditMailer | 
| xlDialogMailLogon | 
| xlDialogMailNextLetter | 
| xlDialogMainChart | 
| xlDialogMainChartType | 
| xlDialogMenuEditor | 
| xlDialogMove | 
| xlDialogNew | 
| xlDialogNewWebQuery | 
| xlDialogNote | 
| xlDialogObjectProperties | 
| xlDialogObjectProtection | 
| xlDialogOpen | 
| xlDialogOpenLinks | 
| xlDialogOpenMail | 
| xlDialogOpenText | 
| xlDialogOptionsCalculation | 
| xlDialogOptionsChart | 
| xlDialogOptionsEdit | 
| xlDialogOptionsGeneral | 
| xlDialogOptionsListsAdd | 
| xlDialogOptionsME | 
| xlDialogOptionsTransition | 
| xlDialogOptionsView | 
| xlDialogOutline | 
| xlDialogOverlay | 
| xlDialogOverlayChartType | 
| xlDialogPageSetup | 
| xlDialogParse | 
| xlDialogPasteNames | 
| xlDialogPasteSpecial | 
| xlDialogPatterns | 
| xlDialogPhonetic | 
| xlDialogPivotCalculatedField | 
| xlDialogPivotCalculatedItem | 
| xlDialogPivotClientServerSet | 
| xlDialogPivotFieldGroup | 
| xlDialogPivotFieldProperties | 
| xlDialogPivotFieldUngroup | 
| xlDialogPivotShowPages | 
| xlDialogPivotSolveOrder | 
| xlDialogPivotTableOptions | 
| xlDialogPivotTableWizard | 
| xlDialogPlacement | 
| xlDialogPrint | 
| xlDialogPrinterSetup | 
| xlDialogPrintPreview | 
| xlDialogPromote | 
| xlDialogProperties | 
| xlDialogProtectDocument | 
| xlDialogProtectSharing | 
| xlDialogPublishAsWebPage | 
| xlDialogPushbuttonProperties | 
| xlDialogReplaceFont | 
| xlDialogRoutingSlip | 
| xlDialogRowHeight | 
| xlDialogRun | 
| xlDialogSaveAs | 
| xlDialogSaveCopyAs | 
| xlDialogSaveNewObject | 
| xlDialogSaveWorkbook | 
| xlDialogSaveWorkspace | 
| xlDialogScale | 
| xlDialogScenarioAdd | 
| xlDialogScenarioCells | 
| xlDialogScenarioEdit | 
| xlDialogScenarioMerge | 
| xlDialogScenarioSummary | 
| xlDialogScrollbarProperties | 
| xlDialogSearch | 
| xlDialogSelectSpecial | 
| xlDialogSendMail | 
| xlDialogSeriesAxes | 
| xlDialogSeriesOptions | 
| xlDialogSeriesOrder | 
| xlDialogSeriesShape | 
| xlDialogSeriesX | 
| xlDialogSeriesY | 
| xlDialogSetBackgroundPicture | 
| xlDialogSetPrintTitles | 
| xlDialogSetUpdateStatus | 
| xlDialogShowDetail | 
| xlDialogShowToolbar | 
| xlDialogSize | 
| xlDialogSort | 
| xlDialogSortSpecial | 
| xlDialogSplit | 
| xlDialogStandardFont | 
| xlDialogStandardWidth | 
| xlDialogStyle | 
| xlDialogSubscribeTo | 
| xlDialogSubtotalCreate | 
| xlDialogSummaryInfo | 
| xlDialogTable | 
| xlDialogTabOrder | 
| xlDialogTextToColumns | 
| xlDialogUnhide | 
| xlDialogUpdateLink | 
| xlDialogVbaInsertFile | 
| xlDialogVbaMakeAddin | 
| xlDialogVbaProcedureDefinition | 
| xlDialogView3d | 
| xlDialogWebOptionsBrowsers | 
| xlDialogWebOptionsEncoding | 
| xlDialogWebOptionsFiles | 
| xlDialogWebOptionsFonts | 
| xlDialogWebOptionsGeneral | 
| xlDialogWebOptionsPictures | 
| xlDialogWindowMove | 
| xlDialogWindowSize | 
| xlDialogWorkbookAdd | 
| xlDialogWorkbookCopy | 
| xlDialogWorkbookInsert | 
| xlDialogWorkbookMove | 
| xlDialogWorkbookName | 
| xlDialogWorkbookNew | 
| xlDialogWorkbookOptions | 
| xlDialogWorkbookProtect | 
| xlDialogWorkbookTabSplit | 
| xlDialogWorkbookUnhide | 
| xlDialogWorkgroup | 
| xlDialogWorkspace | 
| xlDialogZoom | 
使用 Dialogs 集合的 Item 属性以及 Show 方法可显示大约 200 个内置对话框。每个对话框都有一个常量与之对应,这些常量均以“xlDialog”开头。
有关可用常量及其相应参数的列表的详细信息,请参阅内置对话框参数表。
如果试图在不正确的上下文中显示对话框,则 Dialogs 集合的 Item 属性可能会失效。例如,若要显示“数据标签”对话框(使用 Visual Basic 表达式 Application.Dialogs(xlDialogDataLabel).Show),那么活动工作表就必须是图表,否则该属性无效。
返回 Error 对象的单个成员。
expression.Item(Index)
expression 必需。该表达式返回一个 Errors 对象。
Index Variant 类型,必需。Index 也可以是这些常量之一。
| xlEvaluateToError 单元格计算为错误值。 | 
| xlTextDate 单元格包含用 2 位数表示年份的文本日期。 | 
| xlNumberAsText 单元格包含以文本形式存储的数字。 | 
| xlInconsistentFormula 单元格包含一个区域中不一致的公式。 | 
| xlOmittedCells 单元格包含一个省略了区域中某个单元格的公式。 | 
| xlUnlockedFormulaCells 取消锁定的单元格包含一个公式。 | 
| xlEmptyCellReferences 单元格包含一个引用空单元格的公式。 | 
返回一个 Range 对象,该对象代表对指定区域某一偏移量处的区域。
expression.Item(RowIndex, ColumnIndex)
expression 必需。该表达式返回一个 Range 对象。
RowIndex   Variant 类型,必需。要访问的单元格的索引号,顺序为从左到右,再往下。Range.Item(1) 返回区域左上角的单元格,Range.Item(2) 返回紧靠左上角单元格右边的单元格。
ColumnIndex Variant 类型,可选。指明要访问的单元格所在列的列号的数字或字符串,1 或 “A”表示区域中的第一列。
语法 1 使用行号和列号或列标作为索引参数。关于此语法的详细信息,请参阅 Range 对象。RowIndex 和 ColumnIndex 参数为相对偏移量。也就是说,如果 RowIndex 指定为 1,将返回区域内第一行中的单元格,而非工作表的第一行。例如,如果选定区域为单元格 C3,则 Selection.Cells(2, 2) 返回单元格 D4(可用 Item 属性在原始区域之外进行索引)。
返回一个集合的单个对象。
expression.Item(Index)
expression 必需。该表达式返回上面的对象之一。
Index Variant 类型,必需。对象的名称或索引号。
有关返回集合中单个成员的详细信息,请参阅返回集合中的对象。
本示例显示“分析工具库”加载宏的状态。请注意,用作 AddIns 方法索引的字符串就是 AddIn 对象的 Title 属性。
If AddIns.Item("Analysis ToolPak").Installed = True Then
    MsgBox "Analysis ToolPak add-in is installed"
Else
    MsgBox "Analysis ToolPak add-in is not installed"
End If
本示例允许编辑活动的工作表上的区域 A1:A4,并通知用户,然后更改该指定区域的密码并将更改通知用户。
Sub UseChangePassword()
    Dim wksOne As Worksheet
    Set wksOne = Application.ActiveSheet
    ' Establish a range that can allow edits
    ' on the protected worksheet.
    wksOne.Protection.AllowEditRanges.Add _
        Title:="Classified", _
        Range:=Range("A1:A4"), _
        Password:="secret"
    MsgBox "Cells A1 to A4 can be edited on the protected worksheet."
    ' Change the password.
    wksOne.Protection.AllowEditRanges.Item(1).ChangePassword _
        Password:="moresecret"
    MsgBox "The password for these cells has been changed."
End Sub
本示例检查当前选定区域是否为多重选定区域,如果是,则清除其中的第一个子区域的内容。
If Selection.Areas.Count <> 1 Then
    Selection.Areas.Item(1).Clear
End If
下例设置单元格区域 A1:G1 的底部边界的颜色。
Worksheets("Sheet1").Range("a1:g1"). _
    Borders.Item(xlEdgeBottom).Color = RGB(255, 0, 0)
下例通知用户计算成员是否有效。本示例假定数据透视表位于活动的工作表上,该活动工作表包含有效或无效的计算成员。
Sub CheckValidity()
    Dim pvtTable As PivotTable
    Dim pvtCache As PivotCache
    Set pvtTable = ActiveSheet.PivotTables(1)
    Set pvtCache = Application.ActiveWorkbook.PivotCaches.Item(1)
    ' Handle run-time error if external source is not an OLEDB data source.
    On Error GoTo Not_OLEDB
    ' Check connection setting and make connection if necessary.
    If pvtCache.IsConnected = False Then
        pvtCache.MakeConnection
    End If
    ' Check if calculated member is valid.
    If pvtTable.CalculatedMembers.Item(1).IsValid = True Then
        MsgBox "The calculated member is valid."
    Else
        MsgBox "The calculated member is not valid."
    End If
End Sub
本示例对 Chart1 中的趋势线向前和向后延伸的单位数进行设置。本示例应在包含单个带趋势线系列的二维柱形图上运行。
With Charts.Item("Chart1").SeriesCollection(1).Trendlines(1)
    .Forward = 5
    .Backward = .5
End With
本示例查找第一个数据透视表(其中第一个多维数据集字段名中包含“Paris”字符串)。如果查找到该名称,则 Boolean 变量 blnFoundName 将设置为 True。
blnFoundName = False
For Each objPT in ActiveSheet.PivotTables
    Set objCubeField = _
        objPT.CubeFields.Item(1)
    If instr(1,objCubeField.Name, "Paris") <> 0 Then
        blnFoundName = True
        Exit For
    End If
Next objPT
下例演示该功能。在本示例中,Microsoft Excel 向活动工作表添加标识符信息,并向用户返回名称和值。
Sub CheckCustomProperties()
    Dim wksSheet1 As Worksheet
    Set wksSheet1 = Application.ActiveSheet
    ' Add metadata to worksheet.
    wksSheet1.CustomProperties.Add _
        Name:="Market", Value:="Nasdaq"
    ' Display metadata.
    With wksSheet1.CustomProperties.Item(1)
        MsgBox .Name & vbTab & .Value
    End With
End Sub
本示例显示“打开”对话框,并选定“只读”选项。
Application.Dialogs.Item(xlDialogOpen).Show arg3:=True
下例将变量设为工作表 Crew 上筛选区域中第一列的筛选的 On 属性值。
Set w = Worksheets("Crew")
If w.AutoFilterMode Then
    filterIsOn = w.AutoFilter.Filters.Item(1).On
End If
本示例更改第一个水平分页符的位置。
Worksheets(1).HPageBreaks.Item(1).Location = .Range("e5")
下例激活 E5 单元格的第一个超链接。
Worksheets(1).Range("E5").Hyperlinks.Item(1).Follow
本示例拆分第一张工作表所在的窗口,然后滚动窗口左下角的窗格,直至第五行到达此窗格的顶部。
Worksheets(1).Activate
ActiveWindow.Split = True
ActiveWindow.Panes.Item(3).ScrollRow = 5
本示例使活动单元格中的第一个拼音文本字符串可见。
ActiveCell.Phonetics.Item(1).Visible = True
本示例从某个 <DIV> 标记中获取标识符,并在名为 q198.htm 的 Web 页(通过保存某个工作簿得到的)中查找该行。然后,本示例还创建该 Web 页的一个副本 (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
本示例基于单元格 A1 的内容填写 Sheet1 的单元格区域 A1:A10。
Worksheets("Sheet1").Range.Item("A1:A10").FillDown
本示例打开最近使用过的文件列表中的第二个文件。
Application.RecentFiles.Item(2).Open
本示例激活工作表 Sheet1。
Sheets.Item("sheet1").Activate
本示例将第一个智能标记标识符的全称通知给用户。
MsgBox Application.SmartTagRecognizers.Item(1).FullName
本示例通过设置“常规”样式的 Bold 属性来更改活动工作簿中的该样式。
ActiveWorkbook.Styles.Item("Normal").Font.Bold = True
本示例更改第一个垂直分页符的位置。
Worksheets(1).VPageBreaks.Item(1).Location = .Range("e5")
本示例将活动窗口最大化。
Windows.Item(1).WindowState = xlMaximized
本示例将变量 wb 设置为 Myaddin.xla 的工作簿。
Set wb = Workbooks.Item("myaddin.xla")
Item 是集合的默认成员。例如,下面两行代码等价。
ActiveWorkbook.Worksheets.Item(1)
ActiveWorkbook.Worksheets(1)