VBA for Word

hellsreach

New Member
Joined
Dec 22, 2015
Messages
19
I am attempting to write a script in VBA for Word. I am reasonable familiar with VBA in Excel, but my VBA/Word skills are significantly weaker.

What I want to do in automatically change a date plus a few other values. The problem is, I don't automatically know what the date or value is prior to running the macro.

I was hoping there was a way to find a particular piece of text (lets say "in the amount of") and the offset that by 1 word (pretend it previously said $5000), then change to "$7000"

Anyone know how to accomplish this?
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
Like you, I've done much less VBA in Word. I know you can do it the way you describe (with some difficulty). However, I know you can insert variables in your Word document. Then you can update all the variables via VBA, then update the variables all at once. Here are a couple links:



I experimented with those, and got it working in about 5 minutes. Try it out and let us know how it works.
 
Upvote 0
All of what you've described can be done via Find/Replace in Word - including with wildcards for unknown values & dates. That said, why are you trying to do that rather than using a template?

Find/Replace operations in Word can be implemented via macros (I've written many) but, without knowing exactly what you want to do, it's impossible to write such a macro.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,866
Messages
6,121,996
Members
449,060
Latest member
mtsheetz

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