RP1America
Technical User
Note: For those that have helped me previously, this does not pertain exactly to other projects that I have been working on (same documents, different need).
I have a lot of Word documents that I would like to enter a heading and paragraph into. The heading and paragraph are the same for each document and will be placed within the document direct before a different specific paragraph heading which is currently present in each document. However, this specific paragraph heading that would be used as the selection (insertion point) is not always the 2nd, 3rd or 4th paragraph in each document, it varies.
What I need is code to open each document, find the insertion point of where I want the new text (which would be just before a different paragraph heading), insert the new heading and paragraph, format the new heading and paragraph (bold and/or font size), and resave the documents in the same location.
I am new to VBA and I am reluctant to post the code that I have thus far (as I know it is incorrect - I found examples online and cannot figure out how to make it work), therefore I will start with some of the specifics:
Here are the folders that contain all of the documents:
Within each document, I need to find the words: "Withdrawal Charge:" and insert text just before.
Text to be inserted: "Stable Value Account:" with font Arial Narrow, size 11, and bold. On the next line the text would be: "All Contributions and transfers to the Stable Value Account (SVA) will earn interest at the rate in effect at the time such contribution or transfer is made. All monies in the SVA will earn interest at that rate until that rate is changed. We may declare a new rate for the SVA that becomes effective on January 1 of each calendar year; however, we may declare an increase in the rate at any time." with font Arial Narrow, size 10 (no bold). Following this paragraph would need to be an empty line (double return).
That's it. I've found some code examples online, yet with my lack of knowledge, I am unable to excute them correctly. If you would like me to post what I have so far (the incorrect code), I will do so.
Thanks in advance for your help. I really appreciate it!!
I have a lot of Word documents that I would like to enter a heading and paragraph into. The heading and paragraph are the same for each document and will be placed within the document direct before a different specific paragraph heading which is currently present in each document. However, this specific paragraph heading that would be used as the selection (insertion point) is not always the 2nd, 3rd or 4th paragraph in each document, it varies.
What I need is code to open each document, find the insertion point of where I want the new text (which would be just before a different paragraph heading), insert the new heading and paragraph, format the new heading and paragraph (bold and/or font size), and resave the documents in the same location.
I am new to VBA and I am reluctant to post the code that I have thus far (as I know it is incorrect - I found examples online and cannot figure out how to make it work), therefore I will start with some of the specifics:
Here are the folders that contain all of the documents:
Code:
Dim FolIn2 As String
Dim FolIn6 As String
Dim FolIn7 As String
Dim FolIn8 As String
Dim FolIn9 As String
Dim FolIn10 As String
Dim FolIn11 As String
Dim FolIn12 As String
Dim FolIn15 As String
Dim FolIn16 As String
Dim FolIn17 As String
Dim FolIn18 As String
Dim FolIn19 As String
Dim FolIn20 As String
Dim FolIn21 As String
Dim FolIn22 As String
Dim FolIn23 As String
Dim FolIn24 As String
FolIn2 = "I:\Ryan Plew\Copy of Cost Pages Originals\2Proposal - 401(a) 403(b) Cost pages"
FolIn6 = "I:\Ryan Plew\Copy of Cost Pages Originals\1Proposal - 401(k) Cost pages\401(k) FS LS Cost Pages"
FolIn7 = "I:\Ryan Plew\Copy of Cost Pages Originals\1Proposal - 401(k) Cost pages\401(k) TPA OneAlliance Cost Pages"
FolIn8 = "I:\Ryan Plew\Copy of Cost Pages Originals\1Proposal - 401(k) Cost pages\401(k) Unallocated Cost Pages"
FolIn9 = "I:\Ryan Plew\Copy of Cost Pages Originals\3Proposal - 401(a) 457(b) Cost pages\401(a) 457(b) FS LS Cost Pages"
FolIn10 = "I:\Ryan Plew\Copy of Cost Pages Originals\3Proposal - 401(a) 457(b) Cost pages\401(a) 457(b) PFRK Cost Pages"
FolIn11 = "I:\Ryan Plew\Copy of Cost Pages Originals\4Proposal - 403(b) Cost pages\403(b) FS LS Cost Pages"
FolIn12 = "I:\Ryan Plew\Copy of Cost Pages Originals\4Proposal - 403(b) Cost pages\403(b) TPA OneAlliance Cost Pages"
FolIn15 = "I:\Ryan Plew\Copy of Cost Pages Originals\5Proposal - 457(b) Cost pages\457(b) Voluntary Cost Pages"
FolIn16 = "I:\Ryan Plew\Copy of Cost Pages Originals\5Proposal - 457(b) Cost pages\457(b) FS LS Cost Pages\457(b) NR FS LS Cost Pages"
FolIn17 = "I:\Ryan Plew\Copy of Cost Pages Originals\5Proposal - 457(b) Cost pages\457(b) FS LS Cost Pages\457(b) REG FS LS Cost Pages"
FolIn18 = "I:\Ryan Plew\Copy of Cost Pages Originals\5Proposal - 457(b) Cost pages\457(b) PFRK Cost Pages\457(b) NR PFRK Cost Pages"
FolIn19 = "I:\Ryan Plew\Copy of Cost Pages Originals\5Proposal - 457(b) Cost pages\457(b) PFRK Cost Pages\457(b) REG PFRK Cost Pages"
FolIn20 = "I:\Ryan Plew\Copy of Cost Pages Originals\6Proposal Templates - 401(k)"
FolIn21 = "I:\Ryan Plew\Copy of Cost Pages Originals\7Proposal Templates - 401(a) 403(b)"
FolIn22 = "I:\Ryan Plew\Copy of Cost Pages Originals\8Proposal Templates - 401(a) 457(b)"
FolIn23 = "I:\Ryan Plew\Copy of Cost Pages Originals\9Proposal Templates - 403(b)"
FolIn24 = "I:\Ryan Plew\Copy of Cost Pages Originals\10Proposal Templates - 457(b)"
Within each document, I need to find the words: "Withdrawal Charge:" and insert text just before.
Text to be inserted: "Stable Value Account:" with font Arial Narrow, size 11, and bold. On the next line the text would be: "All Contributions and transfers to the Stable Value Account (SVA) will earn interest at the rate in effect at the time such contribution or transfer is made. All monies in the SVA will earn interest at that rate until that rate is changed. We may declare a new rate for the SVA that becomes effective on January 1 of each calendar year; however, we may declare an increase in the rate at any time." with font Arial Narrow, size 10 (no bold). Following this paragraph would need to be an empty line (double return).
That's it. I've found some code examples online, yet with my lack of knowledge, I am unable to excute them correctly. If you would like me to post what I have so far (the incorrect code), I will do so.
Thanks in advance for your help. I really appreciate it!!