How to Fix Excel VBA SpellNumber Function for Currency Codes
Question details
The user needs to resolve an issue with an Excel VBA add-in that uses a SpellNumber function to convert numbers into words for specific currency codes like INR, USD, SAR, and EUR.
- Product
- Excel
- Device & OS
- not provided
- Scenario
- Using a custom VBA macro or add-in to convert numeric values into text strings with specific international currency formatting.
- Observed behavior
- The macro or add-in is likely failing to execute, update, or return the expected text conversion for the specified currencies.
Ensure that macros are enabled in your Excel Trust Center settings and that your VBA add-in file (.xla or .xlam) is saved in a trusted location.
Reload the Excel File and VBA Add-in
Custom VBA functions like SpellNumber can fail to calculate if the add-in connection drops or the workbook state becomes stale. Reloading refreshes the calculation tree.
Often, simply restarting the application and forcing a refresh of the installed add-ins can resolve temporary macro execution glitches without needing to edit the code.
Save your current work and completely close Microsoft Excel to clear the application's cache.
Launch Excel again and open the specific workbook containing your SpellNumber formulas.
Navigate to 'File' > 'Options' > 'Add-ins'. Ensure your custom VBA add-in is active. If it is unchecked, check the box and click 'OK' to reload it.
Press F9 on your keyboard to force a recalculation of all formulas in the workbook.
Debug the VBA Code and Workbook Structure
If reloading doesn't work, there may be a syntax error in the VBA function handling the currency codes or a mismatch in the workbook's structure.
Convert Numbers to Words using Macros in WPS Spreadsheets
WPS Spreadsheets provides robust support for VBA macros, allowing you to seamlessly run custom functions like SpellNumber to handle multiple international currency conversions with ease.
- 1. Open your Workbook: Launch WPS Spreadsheets and open your .xlsm file containing the custom SpellNumber macro.
- 2. Enable Macros: Click on the security warning prompt that appears below the ribbon to 'Enable Macros' for the document.
- 3. Access the VBA Editor: Go to the 'Developer' tab and click on 'Visual Basic' to review or paste your currency conversion code into a new module.
- 4. Apply the Function: Type `=SpellNumber(A1, "USD")` in any cell to instantly convert the numeric value into formatted English text.

Frequently Asked Questions
Why does my SpellNumber function return a #NAME? error?
A #NAME? error typically occurs if the VBA code isn't stored in a standard module within the active workbook, if the add-in is not loaded, or if macros have been disabled by your security settings.
Can I add more currency codes to the SpellNumber VBA script?
Yes. You can edit the VBA code to include additional 'Case' statements that define the major and minor currency names (e.g., Pounds and Pence for GBP) alongside INR, USD, SAR, and EUR.
How do I make the SpellNumber function available in all my workbooks?
To use the function globally, save the workbook containing your VBA code as an Excel Add-in file (.xlam) and activate it via the Excel Add-ins dialog box (File > Options > Add-ins).
Does WPS Office support custom VBA functions like SpellNumber?
Yes, the VBA-enabled versions of WPS Office fully support user-defined custom functions, allowing you to run your existing SpellNumber scripts and add-ins without requiring modifications.




