I'm trying to write a macro in Word 2003 for determining if the cursor's current position is located within a table. Anyone know of a sure-fire "isTable=True" type statement in VBA?
Specifically, what I'm trying to do is navigate to the beginning of a document, then if the beginning of the doc is a table, delete the table and move on.
Below is the code I have so far. I would like to replace the "this is within a table" part with something that works. One thing to know about the table in question is that it has vertically merged rows (which is part of the reason I want to remove it.)
Sub CoverTableDelete()
Selection.HomeKey Unit:=wdStory
If [this is within a table] = True Then
Selection.Tables(1).Select
Selection.Tables(1).Delete
End If
...
End Sub
Specifically, what I'm trying to do is navigate to the beginning of a document, then if the beginning of the doc is a table, delete the table and move on.
Below is the code I have so far. I would like to replace the "this is within a table" part with something that works. One thing to know about the table in question is that it has vertically merged rows (which is part of the reason I want to remove it.)
Sub CoverTableDelete()
Selection.HomeKey Unit:=wdStory
If [this is within a table] = True Then
Selection.Tables(1).Select
Selection.Tables(1).Delete
End If
...
End Sub