How to Fix a Word VBA Macro Replacing Japanese Brackets Incorrectly
Question details
The user needs to correct a VBA macro that is replacing both opening and closing Japanese corner brackets with the same character.

- Product
- Word
- Device & OS
- not provided
- Scenario
- Executing a Find and Replace VBA macro to convert Japanese corner brackets into standard English quotation marks.
- Observed behavior
- The macro incorrectly replaces both the opening and closing brackets with the identical character because the search range overlaps or is not properly reset after the first replacement.
Ensure the Developer tab is enabled in your ribbon so you can access the Visual Basic Editor, and identify the exact Unicode values for the characters you are modifying (12300 for 「 and 12301 for 」).
Use Separate Range Objects and Collapse After Replacement
Resolve the issue by processing each bracket using an independent Range object and collapsing the range after every individual replacement operation.
When a single Range object is used for consecutive Find and Replace operations, the first replacement alters the text length and shifts the range focus. This often causes the subsequent search to target the wrong characters. Isolating the searches into separate Range objects prevents the first replacement from interfering with the second search.
Press ALT + F11 to launch the Visual Basic Editor (VBE) and locate the module containing your specific Find and Replace macro.
Modify your code to declare two distinct Range variables, for example: 'Dim rngOpen As Range' and 'Dim rngClose As Range'.
Set up the first Range object to find the opening Japanese bracket. Use ChrW(12300) in the Find parameter and set the Replacement parameter to ChrW(8220) to insert a standard opening quote.
Immediately after executing the first replacement, collapse the range using 'rngOpen.Collapse Direction:=wdCollapseEnd' so the macro cursor moves past the replaced text.
Set up the second Range object to find the closing Japanese bracket. Use ChrW(12301) for the Find parameter and ChrW(8221) for the Replacement parameter to insert a standard closing quote, then run the macro.

Easily Manage and Edit VBA Macros with WPS Writer
WPS Office provides robust native support for VBA macros, allowing you to efficiently script and automate complex document formatting tasks, including advanced Find and Replace scenarios for Unicode characters.
- 1. Open WPS Writer: Launch WPS Writer and open the document containing the Japanese brackets you need to format.
- 2. Access the Visual Basic Editor: Navigate to the Developer tab on the top ribbon and click 'Macros' or 'Visual Basic' to bring up the macro editor.
- 3. Run Your Code: Paste your updated VBA script with the separate Range objects, click 'Run', and watch the characters convert correctly.

Frequently Asked Questions
Why does my Find and Replace macro replace both brackets with the exact same character?
This occurs when a single Range object is reused without being collapsed. The first replacement modifies the text layout, shifting the internal range boundaries so the second operation mistakenly applies its replacement to the wrong text.
What are the Unicode values for Japanese corner brackets?
The opening Japanese corner bracket (「) is Unicode 12300, and the closing Japanese corner bracket (」) is Unicode 12301. In VBA, you target these characters using the functions ChrW(12300) and ChrW(12301).
How do I collapse a Range in Word VBA?
You can collapse a Range object by calling its Collapse method, usually written as 'YourRange.Collapse Direction:=wdCollapseEnd'. This moves the logical insertion point to the very end of the text you just modified.




