Another Find/Replace Question - Excel(vba) to Word

jagrenet

Board Regular
Joined
Feb 23, 2022
Messages
81
Office Version
  1. 365
  2. 2013
  3. 2011
  4. 2010
Platform
  1. Windows
I have searched the Forums and found a multitude of "Find/Replace" scenarios but, did not run across any with my particular needs. I am quite possibly using the wrong approach altogether.

I have a report that comes out every month which requires some "massaging" of information, (by me) before it gets sent on to the client. There are only 4 or 5 areas of text that need to be changed so I figured if I could get an example of 1 then I should be able to figure the rest out.
In the Word document there is a sentence similar to - "This is my example sentence and it has the date November 2022 which obviously, is different every month."

With my code, I am trying to replace "November 2022" only, while leaving all of the other words untouched. I had thought about using InStr to get this done however, the length of the month will change .... so, I wasn't sure how to approach that exactly.

Also, to make things even more fun, I wanted to be able to use - DateSerial(Year(Now()), Month(Now()), 1) - with the Format of - NumberFormat = "mmmm yyyy" - in an attempt to keep things neat and tidy.
In addition, I would like to use certain variables which contain values from other (previous) sub-routines, in different areas of the Word document. for instance .....
ThisCustomer (would be a variable) and ThisCount (would be a variable) in the following example -

"ThisCustomer requested to purchase (ThisCount) of raffle tickets."

I hope this makes sense.
Thanks for taking a look.
Jeff
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().

Forum statistics

Threads
1,224,826
Messages
6,181,192
Members
453,021
Latest member
pingpong7117

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top