Fix WordBasic Error 509 When Selecting a Table Row in Word 2013
Question details
The user needs to troubleshoot Error 509 in a legacy WordBasic application running 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.
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.
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.
In Word 2013, press Alt+F11 to open the Visual Basic Editor. In the Project pane, open the module containing the affected macro.
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.
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.
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.
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.

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.

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.




