How to Use MoveRight wdCell in Excel VBA with Late-Bound Word
Question details
The user needs to move the cursor one cell to the right in a Word document controlled by Excel VBA via late binding, but the wdCell constant is not recognized.

- Product
- Excel VBA
- Device & OS
- not provided
- Scenario
- Automating Microsoft Word tasks from an Excel macro using late binding.
- Observed behavior
- Excel VBA throws an error or fails to recognize the constant 'wdCell' because the Word Object Library is not referenced in the project.
Ensure that your Excel VBA macro successfully creates or retrieves the late-bound Word application object using CreateObject("Word.Application") before executing movement commands.
Use the Numeric Value for the wdCell Constant
Replace the Word-specific named constant with its underlying numeric value to maintain true late binding without needing external library references.
When using late binding, the host application (Excel) does not load the type library of the target application (Word). Therefore, Word-specific constants like 'wdCell' are completely unknown to Excel VBA.
To bypass this limitation, you must look up the numeric value of the constant and use it directly in your VBA code.
The numeric value for the Word constant 'wdCell' is 12.
Locate the line of code using the MoveRight method in your Excel VBA script.
Change 'objSelection.MoveRight Unit:=wdCell' to 'objSelection.MoveRight Unit:=12'.
Execute the macro again. The cursor should now successfully move one cell to the right within the Word table.
Add a Reference to the Microsoft Word Object Library
If you prefer using named constants and want access to IntelliSense, switch from late binding to early binding by referencing the Word library.
Experience Seamless VBA Compatibility with WPS Office
If you frequently work with macros and document automation, WPS Office offers a powerful, lightweight, and free alternative to Microsoft Office. WPS Spreadsheets and WPS Writer provide excellent support for VBA macros, allowing you to run your automated workflows without expensive subscriptions.
- 1. Download and Install: Get the free version of WPS Office from the official website and install it on your device.
- 2. Open your Macro File: Open your .xlsm or .docm files directly in WPS Spreadsheets or WPS Writer.
- 3. Enable Macros: Click 'Enable Macros' when prompted by the security warning to allow your VBA code to run seamlessly.

Frequently Asked Questions
How can I find the numeric values of other Word VBA constants?
You can find constant values using the Object Browser. Open the VBA Editor in Microsoft Word (Alt + F11), press F2 to open the Object Browser, search for the constant name (like wdCell), and look at the details pane at the bottom to see its underlying numeric value.
What is the difference between early binding and late binding in VBA?
Early binding requires checking the specific object library in Tools > References, which gives you IntelliSense and named constants but binds the code to a specific software version. Late binding uses generic Object variables (e.g., CreateObject) without library references, making the code more version-independent but requiring you to use numeric values instead of named constants.
Why am I getting a 'Variable not defined' error for wdCell?
If you have 'Option Explicit' declared at the top of your Excel VBA module, VBA requires all variables to be defined. Since Excel does not natively recognize Word's 'wdCell' constant without a library reference, it treats it as an undeclared variable. Replacing it with the number 12 resolves the error.




