Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 10-16-2022, 01:20 AM
Emby Emby is offline How to shorten English words of specific length by macro? Windows 7 32bit How to shorten English words of specific length by macro? Office 2000
Novice
How to shorten English words of specific length by macro?
 
Join Date: Nov 2017
Posts: 10
Emby is on a distinguished road
Default How to shorten English words of specific length by macro?

I have a word file containing English and Chinese words. When an English word exceeds four characters, it is necessary to shorten the line of English words to three characters. The rules are as follows:
Before After Rule
a 日 a 日 No change
aa 昌 aa 昌 No change
aaa 晶 aaa 晶 No change
aaam 㬪 aam 㬪 Delete the third character of the English word


aahaf 鷼 aaf 鷼 Delete the third and fourth characters of the English word
Attached Files
File Type: docx TestSample.docx (22.5 KB, 4 views)
Reply With Quote
  #2  
Old 10-16-2022, 05:39 AM
macropod's Avatar
macropod macropod is offline How to shorten English words of specific length by macro? Windows 10 How to shorten English words of specific length by macro? Office 2016
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

You do not need a macro for this. All you need is a wildcard Find/Replace, where:
Find = <([A-Za-z]{2})[A-Za-z]@([A-Za-z])>
Replace = \1\2
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #3  
Old 10-16-2022, 08:43 AM
Emby Emby is offline How to shorten English words of specific length by macro? Windows 7 32bit How to shorten English words of specific length by macro? Office 2000
Novice
How to shorten English words of specific length by macro?
 
Join Date: Nov 2017
Posts: 10
Emby is on a distinguished road
Default

Quote:
Originally Posted by macropod View Post
You do not need a macro for this. All you need is a wildcard Find/Replace, where:
Find = <([A-Za-z]{2})[A-Za-z]@([A-Za-z])>
Replace = \1\2
Thanks macropod for the reply. Am I missing any steps? There are always no search results so that I cannot convert the attached file 1 (Before.docx) to attached file 2 (After.docx). Would you mind helping me?
Attached Files
File Type: docx Before.docx (19.0 KB, 3 views)
File Type: docx After.docx (19.2 KB, 3 views)
Reply With Quote
  #4  
Old 10-16-2022, 02:27 PM
macropod's Avatar
macropod macropod is offline How to shorten English words of specific length by macro? Windows 10 How to shorten English words of specific length by macro? Office 2016
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Did you check the 'Use wildcards' option?
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #5  
Old 10-16-2022, 11:25 PM
Emby Emby is offline How to shorten English words of specific length by macro? Windows 7 32bit How to shorten English words of specific length by macro? Office 2000
Novice
How to shorten English words of specific length by macro?
 
Join Date: Nov 2017
Posts: 10
Emby is on a distinguished road
Default

I got it. Thanks again.
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro in Word to find specific words? Will be used for good cause (prostate cancer research) cancerresearcher Word VBA 15 07-23-2019 01:53 PM
How to shorten English words of specific length by macro? Macro to search for specific words in a document mike0215 Word VBA 2 11-28-2017 07:25 AM
Finding Non-English Words in an English and Non-English words document mohsen.amiri Word 3 03-31-2015 11:20 PM
How to shorten English words of specific length by macro? Need VBA For Macro On How To Remove Specific Words netchie Word VBA 6 08-28-2012 03:37 PM
How to shorten English words of specific length by macro? Macro for highlighting specific number of words icsjohn Word VBA 2 12-07-2011 06:44 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 01:39 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft