3 replies
by dtenbrink Accepted solution
by kenneth.johnson9 Accepted solution
If you are using a table in word, you can check the table using row and column much like referencing in Excel.
This example assumes that each address label is made up of a bunch of tables. If it is a single table then you just need to cycle through the rows and columns.
Let me know if this helps.
---------------------------------------------
Sub stuff()
'check to see if we have tables
If ActiveDocument.Tables.count >= 1 Then
'cycle through the number of tables one at a time
For var_tables = 1 To ActiveDocument.Tables.Count
'look at the second row(cell) in the table
'if blank then set the first row(cell) to nothing
If ActiveDocument.Tables(var_tables).Cell(2, 1).Range.Text = "" Then
ActiveDocument.Tables(1).Cell(1, 1).Range.Text = ""
End If
Next var_tables
End If
--------------------------------------------
End Sub
by thumbsup2 Accepted solution
You said:
If ActiveDocument.Tables(var_tables).Cell(2, 1).Range.Text = "" Then
ActiveDocument.Tables(1).Cell(1, 1).Range.Text = ""
End If
Shouldn't that be:
If ActiveDocument.Tables(var_tables).Cell(2, 1).Range.Text = "" Then
ActiveDocument.Tables(var_tables).Cell(1, 1).Range.Text = ""
End If
If not, wouldn't it always be changing the first occurance of a table and not be following the pointer as it searches through the other tables?
This discussion is closed to new replies.
Trending Hardware posts
Sort by Trending