MS Word Macro question;
I need to convert Scripture references from abbreviated form to whole word form. For instants, Rom. to Romans. Not just for a single book of the Bible but for all. Do I need a separate macro for each book or can I write a single macro with every book listed and change any or all at once?
Comments
-
you could certainly create a macro to change them all at once. Or you could create a user form that would allow you to put a check mark next to the books you want to change. I would open the book as a PB in logos, then print it back to word as a word doc. That way you could write the macro to only change things it finds inside hyperlinks to avoid changing things you may not have intended to change.
0 -
Thanks for the prompt answer. I'm not too familiar with the "user form" but I'll look into it. Sounds promising.
0 -
You might try using wildcards. To convert every instance of the string in quotes "Gen. [any number 0-9]" to Gen. [same number], with MS-Word Wildcards, you could Replace All instances of Gen. with Genesis with the following:
It'd be pretty easy to record a macro with one of these & then edit /expand it afterward to include all of your most common abbreviations for all 66 books. It'll find any instance of your abbreviation in the context of a chapter number.
The text part of the search argument has to be exact (capitalization, etc.).
Blessings!
Grace & Peace,
Bill
MSI GF63 8RD, I-7 8850H, 32GB RAM, 1TB SSD, 2TB HDD, NVIDIA GTX 1050Max
iPhone 12 Pro Max 512Gb
iPad 9th Gen iOS 15.6, 256GB0 -
spitzerpl said:
you could certainly create a macro to change them all at once. Or you could create a user form that would allow you to put a check mark next to the books you want to change. I would open the book as a PB in logos, then print it back to word as a word doc. That way you could write the macro to only change things it finds inside hyperlinks to avoid changing things you may not have intended to change.
Help me understand a user form.... that sounds interesting. Could you give us detail with pix on how to do that?
Grace & Peace,
Bill
MSI GF63 8RD, I-7 8850H, 32GB RAM, 1TB SSD, 2TB HDD, NVIDIA GTX 1050Max
iPhone 12 Pro Max 512Gb
iPad 9th Gen iOS 15.6, 256GB0 -
Thanks Bill! this looks like something I can handle that will work well.[Y]
0 -
Sure. Within VBA I set up the attached userform. and put the following code behind it. If you select select all, it changes all, old testament changes all OTs, New Testament all NTs. I don't have the time to actually set up the replacing of text but this is a sample. If you need more step-by-step on how to do this I might be able to give it to you. I can probably also send you the userform I put together. My VBA knowledge is mostly self-taught so there's probably a better way to go about this.
Option Explicit
Private Sub CancelButton_Click()
Unload Me
End SubPrivate Sub NTSelect_Click()
Dim ct As Control
Select Case NTSelect
Case True
For Each ct In PassageSelect.NTFrame.Controls
ct = True
Next
Case False
For Each ct In PassageSelect.NTFrame.Controls
ct = False
Next
End Select
End Sub
Private Sub OTSelect_Click()
Dim ct As Control
Select Case OTSelect
Case True
For Each ct In PassageSelect.OTFrame.Controls
ct = True
Next
Case False
For Each ct In PassageSelect.OTFrame.Controls
ct = False
Next
End Select
End Sub
Private Sub SelectAll_Click()
Dim ct As ControlSelect Case SelectAll
Case True
For Each ct In PassageSelect.OTFrame.Controls
ct = True
Next
For Each ct In PassageSelect.NTFrame.Controls
ct = True
Next
Case False
For Each ct In PassageSelect.OTFrame.Controls
ct = False
Next
For Each ct In PassageSelect.NTFrame.Controls
ct = False
Next
End Select
End Sub0 -
Thank you spitzerpl. This is a perfect solution. I need to learn about how to do this but it justifies the time spent.
Thanks!
0 -
Hi spitzerpl,
Thanks for modeling what you were talking about... Blessings to you!
Grace & Peace,
Bill
MSI GF63 8RD, I-7 8850H, 32GB RAM, 1TB SSD, 2TB HDD, NVIDIA GTX 1050Max
iPhone 12 Pro Max 512Gb
iPad 9th Gen iOS 15.6, 256GB0 -
I'm new to VBA in word and would greatly appreciate seeing an example that finds and changes both text and style if you happen to have a simple example around.
Blessings.
(this was posted by my husband so please reply to him at )lbdyck@gmail.com
0 -
I too would be interested in the user form and more information.
0