應用於 Adjustments對象的 Item屬性。
返回或設置由 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 類型,必需。對象的索引號。

應用於 Borders對象的 Item屬性。
返回一個Border對象,該對象代表單元格區域或樣式的某一邊框。
expression.Item(Index)
expression 必需。該表達式返回一個 Borders集合。
Index XlBordersIndex 類型,必需。
XlBordersIndex 可為以下 XlBordersIndex 常量之一。 xlDiagonalDown
xlDiagonalUp
xlEdgeBottom
xlEdgeLeft
xlEdgeRight
xlEdgeTop
xlInsideHorizontal
xlInsideVertical

應用於 Dialogs對象的 Item屬性。
返回一個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對象的 Item屬性。
返回 Error對象的單個成員。
expression.Item(Index)
expression 必需。該表達式返回一個 Errors對象。
Index Variant 類型,必需。Index 也可以是這些常量之一。
xlEvaluateToError 單元格計算為錯誤值。
xlTextDate 單元格包含用 2 位數表示年份的文本日期。
xlNumberAsText 單元格包含以文本形式存儲的數字。
xlInconsistentFormula 單元格包含一個區域中不一致的公式。
xlOmittedCells 單元格包含一個省略了區域中某個單元格的公式。
xlUnlockedFormulaCells 取消鎖定的單元格包含一個公式。
xlEmptyCellReferences 單元格包含一個引用空單元格的公式。

應用於 Range對象的 Item屬性。
返回一個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屬性在原始區域之外進行索引)。

應用於“應用於”列表中的其他所有對象的 Item屬性。
返回一個集合的單個對象。
expression.Item(Index)
expression 必需。該表達式返回上面的對象之一。
Index Variant 類型,必需。對象的名稱或索引號。
說明
有關返回集合中單個成員的詳細信息,請參閱返回集合中的對象。
VBA示例

應用於 AddIns對象。
本示例顯示“分析工具庫”加載宏的狀態。請注意,用作 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

應用於 AllowEditRanges對象。
本示例允許編輯活動的工作表上的區域 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

應用於 Areas對象。
本示例檢查當前選定區域是否為多重選定區域,如果是,則清除其中的第一個子區域的內容。
If Selection.Areas.Count <> 1 Then Selection.Areas.Item(1).Clear End If

應用於 Borders對象。
下例設置單元格區域 A1:G1 的底部邊界的顏色。
Worksheets("Sheet1").Range("a1:g1"). _ Borders.Item(xlEdgeBottom).Color = RGB(255, 0, 0)

應用於 CalculatedMembers對象。
下例通知用戶計算成員是否有效。本示例假定數據透視表位於活動的工作表上,該活動工作表包含有效或無效的計算成員。
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

應用於 Charts對象。
本示例對 Chart1 中的趨勢線向前和向后延伸的單位數進行設置。本示例應在包含單個帶趨勢線系列的二維柱形圖上運行。
With Charts.Item("Chart1").SeriesCollection(1).Trendlines(1) .Forward = 5 .Backward = .5 End With

應用於 CubeFields對象。
本示例查找第一個數據透視表(其中第一個多維數據集字段名中包含“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

應用於 CustomProperties對象。
下例演示該功能。在本示例中,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

應用於 Dialogs對象。
本示例顯示“打開”對話框,並選定“只讀”選項。
Application.Dialogs.Item(xlDialogOpen).Show arg3:=True

應用於 Filters對象。
下例將變量設為工作表 Crew 上篩選區域中第一列的篩選的 On屬性值。
Set w = Worksheets("Crew") If w.AutoFilterMode Then filterIsOn = w.AutoFilter.Filters.Item(1).On End If

應用於 HPageBreaks對象。
本示例更改第一個水平分頁符的位置。
Worksheets(1).HPageBreaks.Item(1).Location = .Range("e5")

應用於 Hyperlinks對象。
下例激活 E5 單元格的第一個超鏈接。
Worksheets(1).Range("E5").Hyperlinks.Item(1).Follow

應用於 Panes對象。
本示例拆分第一張工作表所在的窗口,然后滾動窗口左下角的窗格,直至第五行到達此窗格的頂部。
Worksheets(1).Activate ActiveWindow.Split = True ActiveWindow.Panes.Item(3).ScrollRow = 5

應用於 Phonetics對象。
本示例使活動單元格中的第一個拼音文本字符串可見。
ActiveCell.Phonetics.Item(1).Visible = True

應用於 PublishObjects對象。
本示例從某個 <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

應用於 Range對象。
本示例基於單元格 A1 的內容填寫 Sheet1 的單元格區域 A1:A10。
Worksheets("Sheet1").Range.Item("A1:A10").FillDown

應用於 RecentFiles對象。
本示例打開最近使用過的文件列表中的第二個文件。
Application.RecentFiles.Item(2).Open

應用於 Sheets對象。
本示例激活工作表 Sheet1。
Sheets.Item("sheet1").Activate

應用於 SmartTagRecognizer對象。
本示例將第一個智能標記標識符的全稱通知給用戶。
MsgBox Application.SmartTagRecognizers.Item(1).FullName

應用於 Styles對象。
本示例通過設置“常規”樣式的 Bold屬性來更改活動工作簿中的該樣式。
ActiveWorkbook.Styles.Item("Normal").Font.Bold = True

應用於 VPageBreaks對象。
本示例更改第一個垂直分頁符的位置。
Worksheets(1).VPageBreaks.Item(1).Location = .Range("e5")

應用於 Windows對象。
本示例將活動窗口最大化。
Windows.Item(1).WindowState = xlMaximized

應用於 Workbooks對象。
本示例將變量wb 設置為 Myaddin.xla 的工作簿。
Set wb = Workbooks.Item("myaddin.xla")

應用於 Worksheets對象。
Item 是集合的默認成員。例如,下面兩行代碼等價。
ActiveWorkbook.Worksheets.Item(1) ActiveWorkbook.Worksheets(1)
你的贊賞是我堅持原創的動力!
