Document.Tables property (Word)
Returns a Table collection that represents all the tables in the specified document. Read-only.
Syntax
expression. Tables
expression A variable that represents a Document object.
Remarks
For information about returning a single member of a collection, see Returning an object from a collection.
Example
This example creates a 5x5 table in the active document and then applies a predefined format to it.
Selection.Collapse Direction:=wdCollapseStart
Set myTable = ActiveDocument.Tables.Add(Range:=Selection.Range, _
NumRows:=5, NumColumns:=5)
myTable.AutoFormat Format:=wdTableFormatClassic2
This example inserts numbers and text into the first column of the first table in the active document.
num = 90
For Each acell In ActiveDocument.Tables(1).Columns(1).Cells
acell.Range.Text = num & " Sales"
num = num + 1
Next acell
See also
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.
Feedback
https://aka.ms/ContentUserFeedback.
Kommer snart: Under hela 2024 kommer vi att fasa ut GitHub-problem som feedbackmekanism för innehåll och ersätta det med ett nytt feedbacksystem. Mer information finns i:Skicka och visa feedback för