How to Bold and Superscript Numbers in Brackets with a WPS Writer Macro
Question details
The user needs to format only two-digit numbers placed inside angle brackets as bold and superscript in WPS Writer, without changing the brackets or surrounding text.

- Product
- WPS Writer
- Device & OS
- not provided
- Scenario
- The user is editing a document that contains references such as <12> and wants to apply bold and superscript formatting exclusively to the numeric part.
- Observed behavior
- Manual formatting or standard Find and Replace either formats the brackets together with the numbers or cannot restrict the formatting to the digits, so a wildcard or VBA macro method is required.
Open the document in WPS Writer and confirm that the target numbers use plain-text angle brackets, not field codes. If you plan to run a macro, make sure macro execution is enabled in WPS Writer security settings.
Run a WPS Writer VBA Macro to Format Only the Digits
Use this method when you need to keep the angle brackets unchanged and apply bold and superscript only to the two-digit numbers across the whole document.
A VBA-style macro can use wildcard find to locate each angle-bracketed number, then move the selection range one character inward on both sides so formatting is applied only to the digits inside the brackets.
In WPS Writer, press Alt+F11 to open the macro editor window.
Click Insert > Module to create a new module where you can place the formatting macro.
Paste or type a macro that sets MatchWildcards = True, searches for \<[0-9]{1,2}\>, and for each match moves the range start forward by one character and the end backward by one character before applying Font.Bold = True and Font.Superscript = True.
Place the cursor inside the macro and press F5, or open the Macros dialog from the Developer tab, select the macro, and click Run.

Use Wildcard Find and Replace When Brackets Can Be Removed
Choose this method if the angle brackets are not required in the final document and you want a faster Find and Replace workflow.
Format Bracketed Numbers in WPS Writer Without Formatting the Brackets
Use the built-in macro editor and wildcard search in WPS Writer to apply bold and superscript formatting only to the digits inside angle brackets, keeping the brackets unchanged. WPS Writer works with Microsoft Word .docx files, so you can edit and save the same documents in a free, familiar Office environment.
- 1. Open the document in WPS Writer: Launch WPS Writer and open the .docx or .doc file that contains the angle-bracketed numbers.
- 2. Open the macro editor: Press Alt+F11 and insert a new module under the current document.
- 3. Enter the wildcard VBA macro: Create a macro that finds \<[0-9]{1,2}\> and moves the match range inward by one character on each side before applying bold and superscript formatting.
- 4. Run and verify: Run the macro, then review several examples such as <12> to confirm the digits are bold and superscript while the angle brackets remain normal.

Frequently Asked Questions
Can I keep the angle brackets while using only Find and Replace?
In a wildcard Replace, formatting is applied to the replacement text. If the replacement includes the whole match, the brackets are formatted too. To keep the brackets unchanged, use the VBA macro method that moves the range one character inward before formatting.
What should I change if the numbers have one or three digits?
Change the wildcard quantifier in the Find text. Use {1,2} for one- or two-digit numbers, or {1,3} for one- to three-digit numbers, and adjust the VBA range movement if the bracket content length varies.
Does this method work with Microsoft Word .docx files?
Yes. WPS Writer opens and saves .docx files, and the wildcard Find and VBA-style macro approach follows the same Word-compatible logic.
How do I run a macro in WPS Writer?
Press Alt+F11 to open the macro editor, insert a module, paste the macro, and press F5. You can also run it from the Macros dialog under the Developer tab if macro features are enabled.
Why is the Find expression written as \<[0-9]{2}\>?
The backslashes mark the angle brackets as literal characters because angle brackets can be special wildcard tokens. The [0-9]{2} part matches exactly two digits from 0 to 9.




