Forum Discussion

mehulchanpura's avatar
mehulchanpura
Copper Contributor
Mar 20, 2023
Solved

Numbering with Gujarati Numbers.

Hi.
In MS Word 2019 there is an option for to numbering in Hindi language like १, २, ३, ...
but not same option for Gujarati Numbers like ૧, ૨, ૩, ...
I am writing book in Gujarati language and in this book many where I need to use numbering. so, I want it's better if i have an option for to numbering using Gujarati numbers.

If anyone know how can I solve this issue, please guide me or suggest me if it is possible with any other way or trick.

Thanks.  

  • mehulchanpura Unfortunately, all that I can suggest is that you request the facility be added via the Feedback facility under Help.  While that may not help you with the current book, such numbering might be available for a future book.

    In the meantime, if you used one of the available numbering systems and then set up an Excel workbook with those numbers in Column A of Sheet 1 and the corresponding Gujarati numbers in Column B and then when finished your book you ran a macro containing the following code, it will ask you to select the workbook containing the numbers and then replace the numbers used in the document with their Gujarati equivalents.  (I would suggest running it on a copy of the document so that your original remains intact, just in case the result is not as expected).

    Dim FD As FileDialog
    Dim strWorkbook As String
    Set FD = Application.FileDialog(msoFileDialogFilePicker)
    With FD
        .Title = "Select the Workbook containing the numbers."
        .Filters.Clear
        .Filters.Add "Excel Files", "*.xlsx"
        .AllowMultiSelect = False
        If .Show = -1 Then
            strWorkbook = .SelectedItems(1)
        Else
            MsgBox "You did not select a file."
            Exit Sub
        End If
    End With
    Dim xlapp As Object
    Dim xlbook As Object
    Dim xlsheet As Object
    Dim myarray As Variant
    On Error Resume Next
    Set xlapp = GetObject(, "Excel.Application")
    If Err Then
        bstartApp = True
        Set xlapp = CreateObject("Excel.Application")
    End If
    On Error GoTo 0
    Set xlbook = xlapp.Workbooks.Open(strWorkbook)
    Set xlsheet = xlbook.Worksheets(1)
    myarray = xlsheet.Range("A1").CurrentRegion.Value
    xlbook.Close
    If bstartApp = True Then
        xlapp.Quit
    End If
    Set xlapp = Nothing
    Set xlbook = Nothing
    Set xlsheet = Nothing
    ActiveDocument.ConvertNumbersToText
    For i = 2 To UBound(myarray)
        Selection.HomeKey wdStory
        Selection.Find.ClearFormatting
        With Selection.Find
            .Text = myarray(i, 1)
            .Replacement.Text = myarray(i, 2)
            .MatchWildcards = False
            .Wrap = wdFindContinue
            .MatchCase = False
        End With
        Selection.Find.Execute Replace:=wdReplaceAll
    Next i
    

     

7 Replies

  • mehulchanpura Unfortunately, all that I can suggest is that you request the facility be added via the Feedback facility under Help.  While that may not help you with the current book, such numbering might be available for a future book.

    In the meantime, if you used one of the available numbering systems and then set up an Excel workbook with those numbers in Column A of Sheet 1 and the corresponding Gujarati numbers in Column B and then when finished your book you ran a macro containing the following code, it will ask you to select the workbook containing the numbers and then replace the numbers used in the document with their Gujarati equivalents.  (I would suggest running it on a copy of the document so that your original remains intact, just in case the result is not as expected).

    Dim FD As FileDialog
    Dim strWorkbook As String
    Set FD = Application.FileDialog(msoFileDialogFilePicker)
    With FD
        .Title = "Select the Workbook containing the numbers."
        .Filters.Clear
        .Filters.Add "Excel Files", "*.xlsx"
        .AllowMultiSelect = False
        If .Show = -1 Then
            strWorkbook = .SelectedItems(1)
        Else
            MsgBox "You did not select a file."
            Exit Sub
        End If
    End With
    Dim xlapp As Object
    Dim xlbook As Object
    Dim xlsheet As Object
    Dim myarray As Variant
    On Error Resume Next
    Set xlapp = GetObject(, "Excel.Application")
    If Err Then
        bstartApp = True
        Set xlapp = CreateObject("Excel.Application")
    End If
    On Error GoTo 0
    Set xlbook = xlapp.Workbooks.Open(strWorkbook)
    Set xlsheet = xlbook.Worksheets(1)
    myarray = xlsheet.Range("A1").CurrentRegion.Value
    xlbook.Close
    If bstartApp = True Then
        xlapp.Quit
    End If
    Set xlapp = Nothing
    Set xlbook = Nothing
    Set xlsheet = Nothing
    ActiveDocument.ConvertNumbersToText
    For i = 2 To UBound(myarray)
        Selection.HomeKey wdStory
        Selection.Find.ClearFormatting
        With Selection.Find
            .Text = myarray(i, 1)
            .Replacement.Text = myarray(i, 2)
            .MatchWildcards = False
            .Wrap = wdFindContinue
            .MatchCase = False
        End With
        Selection.Find.Execute Replace:=wdReplaceAll
    Next i
    

     

Resources