Delete Table VBA Help
Hi, I am designing a word document and hoping someone can help me with a VBA that I am stuck on.
I have a command button at the top of the document to delete a table and I am trying to programme the macro so that whichever table the cursor is in is deleted when the button is pressed.
I am aware that all the tables are indexed so my current plan is to count the table number of which I currently have the following code:
Sub tabnum()
Dim tabnum
tabnum = ActiveDocument.Range(0, Selection.Tables(1).Range.End).Tables.Count
End Sub
This works and calculate the current tables index number, however I am struggling for where to go from there to actually delete that table
I believe it will be something like selection.tables(tabnum).delete however that doesn't work.
Many thanks for any help
Andy
|