Arabic text format in excel does not change using "TYPETEXT" function in VBA when transferring text to a new Word document RRS feed

  • Question

  • I'm trying to make a simple code to transfer Arabic text from Excel to word using "TYPETEXT" function in VBA. It works fine except it does not format the text as I need. It does the "UNDERLINE" and the "BOLDRUN" functions fine, however it doesn't change the font style and the size. it only works fine on English text. I also tried changing the language

    Take a look at my code below.

    Sub createnewmsw()
    Dim wApp As Word.Application
    Dim wDoc As Word.Document
    Set wApp = CreateObject("word.application")
    wApp.Visible = True
    Set wDoc = wApp.Documents.Add
    wDoc.Content.LanguageID = wdArabic
    With wApp.Selection
    .Paragraphs.Alignment = wdAlignParagraphRight
    .Font.Size = 16
    .Font.Name = "Sakkal Majalla"
    .TypeText Range("A1")
    .Font.Underline = True
    .TypeText Range("A2")
    .Font.Underline = False
    .Paragraphs.Alignment = wdAlignParagraphLeft
    .TypeText Range("A3")
    .TypeText Range("A4")
    End With
    End Sub

    Wednesday, July 25, 2018 6:51 PM

All replies

  • Hello maddahfm,

    In my test, the code could change the font style and font size for me. What's the version of your office? Could you reproduce the issue on another PC?

    Please check my test steps. Did I misunderstand any thing?

    Best Regards,


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Thursday, July 26, 2018 5:39 AM
  • Hi Terry,

    Thanks for your response and my apologies for replying so late since I forgot that I posted this. I'm using a 2013 version of MS Excel. I also tried the same code on a 2016 version in another PC. Is there anything I have to change in the settings of Excel for example?



    • Edited by maddahfm Wednesday, September 19, 2018 5:00 AM grammer mistake
    Wednesday, September 19, 2018 4:59 AM