Strip off the last two characters when assigning the Text property to a string: : Document Table « Word « VBA / Excel / Access / Word

Home
VBA / Excel / Access / Word
1.Access
2.Application
3.Data Type
4.Data Type Functions
5.Date Functions
6.Excel
7.File Path
8.Forms
9.Language Basics
10.Math Functions
11.Outlook
12.PowerPoint
13.String Functions
14.Windows API
15.Word
16.XML
VBA / Excel / Access / Word » Word » Document Table 




Strip off the last two characters when assigning the Text property to a string:
 
Sub strip()
    Dim strCellText As String
    
    strCellText = ActiveDocument.Tables(3).Rows(2).Cells(1).Range.Text
    Debug.Print strCellText
    strCellText = Left(strCellText, Len(strCellText2)
    Debug.Print strCellText
End Sub

 














Related examples in the same category
1.inserts a new, blank, non-autofitting table containing 10 rows and 5 columns at the current position of the insertion point in the active document:
2.Selecting a Table in the active document:
3.Declare the variable tempTable and then select the first table in the document named Log.doc and assign its Range object to tempTable
4.Selects the first table in the current selection:
5.Converts the current selection to a five-column table, separating the information at commas.
6.Making Sure the Selection Is within a Table
7.Finding Out Where the Selection Is in the Table
8.Adding a Column to a Table
9.Deleting a Column from a Table
10.Setting the Width of a Column
11.The SetWidth method sets the width of one or more columns and specify how the other columns in the table should change as a result: expression.SetWidth ColumnWidth, RulerStyle
12.The Width property lets you change the width of a column without worrying about the effect on the other columns. Specify the width you want in points-for example:
13.Selecting a Column
14.Adding a Row to a Table
15.Deleting a Row from a Table
16.Setting the Height of One or More Rows
17.Set the Height property of the row or rows in question by specifying the height in points
18.Selecting a Row
19.Inserting a Cell
20.Returning the Text within a Cell
21.Entering Text in a Cell
22.Deleting Cells
23.wdDeleteCellsEntireRow deletes the whole row.
24.wdDeleteCellsShiftLeft moves cells across to the left to fill the gap.
25.wdDeleteCellsShiftUp moves cells up to fill the gap.
26.Deletes the first cell in the first row of the first table in the active document and shifts the other cells in the first row to the left to fill the gap:
27.Selecting a Range of Cells
28.Converting a Table or Rows to Text
29.Use the ConvertToText method with a Table object, a Row object, or a Rows collection: converts only the first row of the selected table to tab-delimited text
30.Convert the first table in the document to text separated by paragraphs
31.wdEndOfRangeColumnNumber returns the number of the column in which the end of the selection or range falls.
32.delete the column in which the range testRange ends if the range is more than one column wide:
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.