Converting numbers to Roman Numerals in Microsoft Word

eemmpph
eemmpph used Ask the Experts™
on
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.

However,

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?
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

Author

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.
Retired
Top Expert 2012
Commented:
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")
        fld.Update
    End If
    ActiveDocument.ActiveWindow.View.ShowFieldCodes = False
End Sub

Open in new window

Author

Commented:
Thank you very much . . . That works for me!

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial