Converting numbers to Roman Numerals in Microsoft Word

I want to convert any number that I highlight to a roman numeral in my Microsoft Word document.

I already know how to use Ctrl+F9 to insert a field, and type a formula in the brackets:  {=4\*ROMAN} and do an Alt+F9 to toggle between the results and the formula.


Question 1:  Instead of me manually typing out the formula every time, is there a way I can hightlight an existing number in the document, say 2019, and replace with with  {=2019\*ROMAN} ?

Question 2:  I noticed if I copy {=4\*ROMAN} and paste it to another area of my document, then change the 4 to a 10, the end result still is IV, instead of X.  How come Word does not use 10 instead of 4?
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

eemmpphAuthor Commented:
Forget question 2.  I see that after I change it from 4 to 10 while still highlighted, and press Alt+F9, it does change to X.
You could use a VBA macro like this, You will need to Select the number in the document before running the code.

Sub ToRoman()
    Dim strText As String
    Dim fld As Field
    strText = Trim(Selection.Text)
    If IsNumeric(strText) Then
        Set fld = ActiveDocument.Fields.Add(Selection.Range, wdFieldEmpty, "=" & strText & "\*ROMAN")
    End If
    ActiveDocument.ActiveWindow.View.ShowFieldCodes = False
End Sub

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
eemmpphAuthor Commented:
Thank you very much . . . That works for me!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Word

From novice to tech pro — start learning today.