Item Method

Microsoft Word Visual Basic

Show All

Item Method

       

Item method as it applies to the Borders object.

Returns a border in a range or selection.

expression.Item(Index)

expression   Required. An expression that returns a Borders object.

Index  Required WdBorderType. The border to be returned.

WdBorderType can be one of these WdBorderType constants.
wdBorderBottom
wdBorderDiagonalDown
wdBorderDiagonalUp
wdBorderHorizontal
wdBorderLeft
wdBorderRight
wdBorderTop
wdBorderVertical

Item method as it applies to the Dialogs object.

Returns a dialog in Microsoft Word.

expression.Item(Index)

expression   Required. An expression that returns a Dialogs object.

Index  Required WdWordDialog. A constant that specifies the dialog.

WdWordDialog can be one of these WdWordDialog constants.
wdDialogMailMergeInsertSet
wdDialogConnect
wdDialogConsistencyChecker
wdDialogControlRun
wdDialogConvertObject
wdDialogCopyFile
wdDialogCreateAutoText
wdDialogDocumentStatistics
wdDialogDrawAlign
wdDialogDrawSnapToGrid
wdDialogEditAutoText
wdDialogEditCreatePublisher
wdDialogEditFind
wdDialogEditFrame
wdDialogEditGoTo
wdDialogEditGoToOld
wdDialogEditLinks
wdDialogEditObject
wdDialogEditPasteSpecial
wdDialogEditPublishOptions
wdDialogEditReplace
wdDialogEditStyle
wdDialogEditSubscribeOptions
wdDialogEditSubscribeTo
wdDialogEditTOACategory
wdDialogEmailOptions
wdDialogFileDocumentLayout
wdDialogFileFind
wdDialogFileMacCustomPageSetupGX
wdDialogFileMacPageSetup
wdDialogFileMacPageSetupGX
wdDialogFileNew
wdDialogFileOpen
wdDialogFilePageSetup
wdDialogFilePrint
wdDialogFilePrintOneCopy
wdDialogFilePrintSetup
wdDialogFileRoutingSlip
wdDialogFileSaveAs
wdDialogFileSaveVersion
wdDialogFileSummaryInfo
wdDialogFileVersions
wdDialogFitText
wdDialogFontSubstitution
wdDialogFormatAddrFonts
wdDialogFormatBordersAndShading
wdDialogFormatBulletsAndNumbering
wdDialogFormatCallout
wdDialogFormatChangeCase
wdDialogFormatColumns
wdDialogFormatDefineStyleBorders
wdDialogFormatDefineStyleFont
wdDialogFormatDefineStyleFrame
wdDialogFormatDefineStyleLang
wdDialogFormatDefineStylePara
wdDialogFormatDefineStyleTabs
wdDialogFormatDrawingObject
wdDialogFormatDropCap
wdDialogFormatEncloseCharacters
wdDialogFormatFont
wdDialogFormatFrame
wdDialogFormatPageNumber
wdDialogFormatParagraph
wdDialogFormatPicture
wdDialogFormatRetAddrFonts
wdDialogFormatSectionLayout
wdDialogFormatStyle
wdDialogFormatStyleGallery
wdDialogFormatStylesCustom
wdDialogFormatTabs
wdDialogFormatTheme
wdDialogFormFieldHelp
wdDialogFormFieldOptions
wdDialogFrameSetProperties
wdDialogHelpAbout
wdDialogHelpWordPerfectHelp
wdDialogHelpWordPerfectHelpOptions
wdDialogHorizontalInVertical
wdDialogIMESetDefault
wdDialogInsertAddCaption
wdDialogInsertAutoCaption
wdDialogInsertBookmark
wdDialogInsertBreak
wdDialogInsertCaption
wdDialogInsertCaptionNumbering
wdDialogInsertCrossReference
wdDialogInsertDatabase
wdDialogInsertDateTime
wdDialogInsertField
wdDialogInsertFile
wdDialogInsertFootnote
wdDialogInsertFormField
wdDialogInsertHyperlink
wdDialogInsertIndex
wdDialogInsertIndexAndTables
wdDialogInsertMergeField
wdDialogInsertNumber
wdDialogInsertObject
wdDialogInsertPageNumbers
wdDialogInsertPicture
wdDialogInsertSubdocument
wdDialogInsertSymbol
wdDialogInsertTableOfAuthorities
wdDialogInsertTableOfContents
wdDialogInsertTableOfFigures
wdDialogLetterWizard
wdDialogListCommands
wdDialogMailMerge
wdDialogMailMergeCheck
wdDialogMailMergeCreateDataSource
wdDialogMailMergeCreateHeaderSource
wdDialogMailMergeFieldMapping
wdDialogMailMergeFindRecord
wdDialogMailMergeHelper
wdDialogMailMergeInsertAddressBlock
wdDialogMailMergeInsertAsk
wdDialogMailMergeInsertFields
wdDialogMailMergeInsertFillIn
wdDialogMailMergeInsertGreetingLine
wdDialogMailMergeInsertIf
wdDialogMailMergeInsertNextIf
wdDialogMailMergeInsertSkipIf
wdDialogMailMergeOpenDataSource
wdDialogMailMergeOpenHeaderSource
wdDialogMailMergeQueryOptions
wdDialogMailMergeRecipients
wdDialogMailMergeUseAddressBook
wdDialogMarkCitation
wdDialogMarkIndexEntry
wdDialogMarkTableOfContentsEntry
wdDialogNewToolbar
wdDialogNoteOptions
wdDialogOrganizer
wdDialogPhoneticGuide
wdDialogReviewAfmtRevisions
wdDialogSearch
wdDialogTableAutoFormat
wdDialogTableCellOptions
wdDialogTableColumnWidth
wdDialogTableDeleteCells
wdDialogTableFormatCell
wdDialogTableFormula
wdDialogTableInsertCells
wdDialogTableInsertRow
wdDialogTableInsertTable
wdDialogTableOfCaptionsOptions
wdDialogTableOfContentsOptions
wdDialogTableProperties
wdDialogTableRowHeight
wdDialogTableSort
wdDialogTableSplitCells
wdDialogTableTableOptions
wdDialogTableToText
wdDialogTableWrapping
wdDialogTCSCTranslator
wdDialogTextToTable
wdDialogToolsAcceptRejectChanges
wdDialogToolsAdvancedSettings
wdDialogToolsAutoCorrect
wdDialogToolsAutoCorrectExceptions
wdDialogToolsAutoManager
wdDialogToolsAutoSummarize
wdDialogToolsBulletsNumbers
wdDialogToolsCompareDocuments
wdDialogToolsCreateDirectory
wdDialogToolsCreateEnvelope
wdDialogToolsCreateLabels
wdDialogToolsCustomize
wdDialogToolsCustomizeKeyboard
wdDialogToolsCustomizeMenuBar
wdDialogToolsCustomizeMenus
wdDialogToolsDictionary
wdDialogToolsEnvelopesAndLabels
wdDialogToolsHangulHanjaConversion
wdDialogToolsHighlightChanges
wdDialogToolsHyphenation
wdDialogToolsLanguage
wdDialogToolsMacro
wdDialogToolsMacroRecord
wdDialogToolsManageFields
wdDialogToolsMergeDocuments
wdDialogToolsOptions
wdDialogToolsOptionsAutoFormat
wdDialogToolsOptionsAutoFormatAsYouType
wdDialogToolsOptionsBidi
wdDialogToolsOptionsCompatibility
wdDialogToolsOptionsEdit
wdDialogToolsOptionsFileLocations
wdDialogToolsOptionsFuzzy
wdDialogToolsOptionsGeneral
wdDialogToolsOptionsPrint
wdDialogToolsOptionsSave
wdDialogToolsOptionsSpellingAndGrammar
wdDialogToolsOptionsTrackChanges
wdDialogToolsOptionsTypography
wdDialogToolsOptionsUserInfo
wdDialogToolsOptionsView
wdDialogToolsProtectDocument
wdDialogToolsProtectSection
wdDialogToolsRevisions
wdDialogToolsSpellingAndGrammar
wdDialogToolsTemplates
wdDialogToolsThesaurus
wdDialogToolsUnprotectDocument
wdDialogToolsWordCount
wdDialogTwoLinesInOne
wdDialogUpdateTOC
wdDialogViewZoom
wdDialogWebOptions
wdDialogWindowActivate

Item method as it applies to the HeadersFooters object.

Returns a header or footer in a range or selection.

expression.Item(Index)

expression   Required. An expression that returns a HeadersFooters object.

Index  Required WdHeaderFooterIndex. A constant that specifies the header or footer in the selection.

WdHeaderFooterIndex can be one of these WdHeaderFooterIndex constants.
wdHeaderFooterEvenPages
wdHeaderFooterFirstPage
wdHeaderFooterPrimary

Item method as it applies to the ListGalleries object.

Returns the type of list (bulleted, numbered or outline) from the list template gallery.

expression.Item(Index)

expression   Required. An expression that returns a ListGalleries object.

Index  Required WdListGalleryType.  A constant that specifies the type of list.

WdListGalleryType can be one of these WdListGalleryType constants.
wdBulletGallery
wdNumberGallery
wdOutlineNumberGallery

Item method as it applies to the MappedDataFields object.

Returns a specified mapped data field.

expression.Item(Index)

expression   Required. An expression that returns a MappedDataFields object.

Index  Required WdMappedDataFields. The specified mapped data field.

WdMappedDataFields can be one of these WdMappedDataFields constants.
wdAddress1
wdAddress2
wdBusinessFax
wdBusinessPhone
wdCity
wdCompany
wdCountryRegion
wdCoutesyTitle
wdEmailAddress
wdFirstName
wdHomeFax
wdHomePhone
wdJobTitle
wdLastName
wdMiddleName
wdNickname
wdPostalCode
wdSpouseCourtesyTitle
wdSpouseFirstName
wdSpouseLastName
wdSpouseMiddleName
wdSpouseNickname
wdState
wdSuffix
wdUniqueIdentifier
wdWebPageURL

Item method as it applies to the StoryRanges object.

Returns a single story of a range or selection as a Range object.

expression.Item(Index)

expression   Required. An expression that returns a StoryRanges object.

Index  Required WdStoryType. The specified story type.

WdStoryType can be one of these WdStoryType constants.
wdCommentsStory
wdEndnotesStory
wdEvenPagesFooterStory
wdEvenPagesHeaderStory
wdFirstPageFooterStory
wdFirstPageHeaderStory
wdFootnotesStory
wdMainTextStory
wdPrimaryFooterStory
wdPrimaryHeaderStory
wdTextFrameStory

Item method as it applies to the TaskPanes object.

Returns the specified task pane as a TaskPane object.

expression.Item(Index)

expression   Required. An expression that returns a TaskPanes object.

Index  Required WdTaskPanes. The specified task pane.

WdTaskPanes can be one of these WdTaskPanes constants.
wdTaskPaneFormatting
wdTaskPaneInspector
wdTaskPaneMailMerge
wdTaskPaneSearch
wdTaskPaneTranslate

Item method as it applies to the Zooms object.

Returns the specified Zoom object.

expression.Item(Index)

expression   Required. An expression that returns a Zooms object.

Index  Required WdViewType. The specified zoom type.

WdViewType can be one of these WdViewType constants.
wdMasterView
wdNormalView
wdOutlineView
wdPrintPreview
wdPrintView
wdWebView
Item method as it applies to all other objects in the Applies To list.

Returns an individual object in a collection.

expression.Item(Index)

expression   Required. An expression that returns one of the objects in the above list.

Index  Required Variant or Long. The individual object to be returned.

For the following objects, Index can be a Variant indicating the ordinal position or a string representing the name of the individual object.

AddIns
AutoCaptions
AutoCorrectEntries
AutoTextEntries
Bookmarks
CanvasShapes
CaptionLabels
CustomLabels
CustomProperties
DiagramNodeChildren
DiagramNodes
Dictionaries
Documents
EmailSignatureEntries
FileConverters
FirstLetterExceptions
FormFields
GroupShapes
HangulAndAlphabetExceptions
HangulHanjaConversionDictionaries
Hyperlinks
Languages
ListEntries
ListTemplates
MailMergeDataFields
MailMergeFieldNames
OtherCorrectionsExceptions
ReadabilityStatistics
Reviewers
ShapeRange
Shapes
ShapeNodes
SmartTags
Styles
StyleSheets
TablesOfAuthoritiesCategories
TabStops
Tasks
Templates
TwoInitialCapsExceptions
Variables
Windows

For the following objects, Index can be a Long indicating the ordinal position of the individual object.

Adjustments
Cells
Characters
Columns
Comments
Endnotes
Fields
FontNames
Footnotes
Frames
HeadingStyles
HTMLDivisions
Indexes
InlineShapes
KeyBindings
KeysBoundTo
Lists
ListLevels
ListParagraphs
MailMergeFields
PageNumbers
Panes
Paragraphs
ProofreadingErrors
RecentFiles
Revisions
Rows
Sections
Sentences
SpellingSuggestions
Subdocuments
Tables
TablesOfAuthorities
TablesOfContents
TablesOfFigures
TextColumns
Versions
Words

Example

As it applies to the Bookmarks object.

This example selects the bookmark named "temp" in the active document.

Sub BookmarkItem()
    If ActiveDocument.Bookmarks.Exists("temp") = True Then
        ActiveDocument.Bookmarks.Item("temp").Select
    End If
End Sub

As it applies to the Borders object.

This example inserts a double border above the first paragraph in the active document.

Sub BorderItem()
    ActiveDocument.Paragraphs(1).Borders.Item(wdBorderTop) _
        .LineStyle = wdLineStyleDouble
End Sub

As it applies to the Dialogs object.

This example displays the Page Setup dialog.

Sub DialogItem()
    Application.Dialogs.Item(wdDialogFileDocumentLayout).Display
End Sub

As it applies to the Documents object.

This example displays the name of the first document in the Documents collection.

Sub DocumentItem()
    If Documents.Count >= 1 Then
        MsgBox Documents.Item(1).Name
    End If
End Sub

As it applies to the HeadersFooters object.

This example creates and formats a first page header in the active document.

Sub HeadFootItem()
    ActiveDocument.PageSetup.DifferentFirstPageHeaderFooter = True
    With ActiveDocument.Sections(1).Headers _
            .Item(wdHeaderFooterFirstPage).Range
        .InsertBefore "Sales Report"
        With .Font
            .Bold = True
            .Size = "15"
            .Color = wdColorBlue
        End With
        .Paragraphs.Alignment = wdAlignParagraphCenter
    End With
End Sub

As it applies to the ListEntries object.

This example clears all the items from the drop-down form field named "Colors" and then adds two color names. The Item method is used to display the first color in the drop-down form field.

Sub ListEntryItem()
    Dim d As DropDown
    Set d = ActiveDocument.FormFields.Add _
        (Range:=Selection.Range, _
        Type:=wdFieldFormDropDown).DropDown
    With d.ListEntries
        .Add Name:="Black"
        .Add Name:="Green"
    End With
    MsgBox d.ListEntries.Item(1).Name
End Sub