![]() |
|
|
|
#1
|
||||
|
||||
|
Quote:
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
#2
|
|||
|
|||
|
You were very close to a solution by the use of the count property. You just needed to apply it to the table range rather than count rows.
Code:
Sub process_table(this_table As Word.Table)
Dim a_range As Word.Range
Set a_range = this_table.Range
Do While a_range.Tables.Count > 0
'Put your code here
Loop
End Sub
|
|
#3
|
|||
|
|||
|
ON rereading the original post my example might be better as
Code:
Sub process_table(this_table As Word.Table)
Dim a_range As Word.Range
Set a_range = this_table.Range
' Do a process on the table
If a_range.Tables.Count = 0 Then Exit Sub
' Do a process on the table
If a_range.Tables.Count = 0 Then Exit Sub
' Do a process on the table
If a_range.Tables.Count = 0 Then Exit Sub
Loop
End Sub
|
|
#4
|
|||
|
|||
|
Quote:
Code:
' Remove empty rows
rowCount = oTbl.Rows.count
columnCount = oTbl.Columns.count
For row = rowCount To 1 Step -1
delete = True
For column = 1 To columnCount
If Not (oTbl.Cell(row, column).Range.Text = Chr(13) & Chr(7)) Then
delete = False
Exit For
End If
Next column
If (delete) Then
' Remove row
Call oTbl.Rows(row).delete
End If
Next row
' NOTE: Need to check to see if table still exists here (If all rows were deleted)
If (tableExists(oTbl)) Then ' Can't test for Nothing - object has been deleted, but is NOT nothing.
' Do other processing steps to table...
|
|
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| set row object variable error | CLoos | Excel Programming | 6 | 03-10-2017 04:48 PM |
Run-time error '424': Object required
|
zlodeh | Excel Programming | 1 | 02-24-2016 01:58 AM |
Run Time Error 424 - Object Required
|
Doug Needham | Excel Programming | 4 | 01-12-2015 10:54 PM |
Error Message: Could not load an object...
|
simstem | Word | 1 | 10-06-2012 08:44 PM |
| XML parsing & Object variable not set (Error 91) | tinfanide | Excel Programming | 0 | 12-29-2011 08:43 AM |