Others

Fix WordBasic Error 509 When Selecting a Table Row in Word 2013

Jason MillerJason Miller Nov 27, 2026 868 views

Question details

The user needs to troubleshoot Error 509 in a legacy WordBasic application running in Word 2013.

Fix WordBasic Error 509 When Selecting a Table Row in Word 2013
Product
Microsoft Word 2013
Device & OS
not provided
Scenario
A legacy WordBasic macro clears document content and later attempts to select a table row.
Observed behavior
WordBasic.TableSelectRow may raise Error 509 when the table it expects has already been cleared.
Before you start

Open the affected document and locate the macro that raises Error 509. Make sure you can inspect its code in the Visual Basic Editor and identify the table the macro is supposed to use.

Solution 1Recommended

Check whether the macro clears the table before selecting its row

Use this approach when WordBasic.TableSelectRow fails after commands that select and clear document content.

WordBasic.EditSelectAll followed by WordBasic.WW6_EditClear can remove the table from the active document. A subsequent table-row selection cannot work if the expected table no longer exists. The exact cause should be confirmed in the affected document and macro.

1
Open the macro code

In Word 2013, press Alt+F11 to open the Visual Basic Editor. In the Project pane, open the module containing the affected macro.

2
Find the clear and selection commands

In the code window, look for WordBasic.EditSelectAll, WordBasic.WW6_EditClear, and the later WordBasic.TableSelectRow call. Check their execution order and any conditions around them.

3
Step through the macro

Place the cursor in the macro and use Debug > Step Into, or press F8, to run it one statement at a time. Check the document and current selection before and after the clear command.

4
Correct the execution order

In the code window, move the table-row operation before the clear operation if that matches the intended workflow, or revise the clear operation so it does not remove the table needed later.

5
Test the revised macro

Run the macro again from the Visual Basic Editor and confirm that the intended table exists when WordBasic.TableSelectRow runs and that the remaining steps produce the expected document.

Check whether the macro clears the table before selecting its row
Check the specific document: If the table is still present, inspect the selection and surrounding code. Error 509 may require further investigation of the affected document and macro.
Free Microsoft Office alternative

Edit Word Documents with WPS Writer

WPS Office is a free, lightweight Office alternative with a familiar interface and Microsoft Office format compatibility for an easier move to everyday document editing. It does not fix Word 2013 WordBasic errors.

Open and edit documents with tables in WPS WriterCompatible with Microsoft Word formats, including DOC and DOCXFamiliar document-editing interfaceFree, lightweight alternative for everyday Office work
microsoft office alternative - wps office

Frequently Asked Questions

Why does WordBasic.TableSelectRow raise Error 509?

One possible cause is that an earlier WordBasic.EditSelectAll and WordBasic.WW6_EditClear sequence removed the table. Step through the macro in the Visual Basic Editor and check whether the expected table and selection still exist at the row-selection command.

How can I inspect the macro in Word 2013?

Press Alt+F11 to open the Visual Basic Editor, then use the Project pane to find the module containing the macro. Use Debug > Step Into or F8 to follow its execution.

Should I always move the clear command to the end?

No. Change the order only if it matches the intended workflow. The macro may instead need to clear a smaller range or recreate the table before selecting a row.

Can WPS Office fix a WordBasic macro error in Word 2013?

No. The macro must be investigated and corrected in Word. WPS Writer is an alternative for editing Word documents, but it is not a repair tool for Word 2013 WordBasic errors.