Word Wildcard issues

yanlok1345
StarLounger
Posts: 74
Joined: 18 Oct 2023, 14:48

Word Wildcard issues

Post by yanlok1345 »

Hello everyone,

I hope you're all doing well. I am currently working on a Word macro and I am in need of some assistance. My task involves finding and replacing names in a Word document based on a list in Excel. To achieve this, I have been using wildcards with the following setup:

[Find] - Column A: ABC[!Member]
[Replace] - Column B: ABCMember

However, I have encountered an issue when there are punctuation marks following the "ABC" portion, such as "ABC,". In such cases, the replacement replaces "ABC" with "ABCMember" but unintentionally removes the comma.

I would greatly appreciate it if someone could guide me on how to modify the wildcard expression in order to avoid the aforementioned issue. Thank you very much for your kind assistance!

User avatar
HansV
Administrator
Posts: 78549
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Word Wildcard issues

Post by HansV »

Find: Abc([!member])
Replace: Abcmember\1
Best wishes,
Hans

yanlok1345
StarLounger
Posts: 74
Joined: 18 Oct 2023, 14:48

Re: Word Wildcard issues

Post by yanlok1345 »

HansV wrote:
09 Jan 2024, 11:04
Find: Abc([!member])
Replace: Abcmember\1
I would like to express my heartfelt appreciation for the invaluable assistance you have provided. Your help has been tremendously valuable, and I am extremely grateful for your support.