How to make text bold after appending a text in word file

I am trying to append text in the word file but I want to make it bold and change the font. The VBA code won’t work as I think invoke VBA is only for excel file in modern activities. any suggestions?

  • Go to Activities Panel → Right-click → Enable Show Classic.
  • Use Word Application Scope to open your Word file.
  • Use Append Text to insert your text.
  • Use Set Font and Set Bold to format the last added text.

If it is correct than mark it as solution

happy automation

Unfortunately no. even the classic append text activity, there is no option to make it bold.

Hi @kshitij.bhatnagar

Please check below same thread,

If you found helpful, feel free to tick as a solution.
Happy Automation

Can you invoke a vba code for word. it was only for excel

Hi @kshitij.bhatnagar

try the below invoke code:

Dim wordApp As New Microsoft.Office.Interop.Word.Application
Dim doc As Microsoft.Office.Interop.Word.Document = wordApp.Documents.Open(CType(filePath, String))

wordApp.Visible = False
Dim para As Microsoft.Office.Interop.Word.Paragraph = doc.Content.Paragraphs.Add()
para.Range.Text = CType(textToAppend, String)
para.Range.Font.Bold = 1 ' 1 = True
para.Range.InsertParagraphAfter()

doc.Save()
doc.Close()
wordApp.Quit()

Invoked code Arguments:

In filePath pass you word document file path.

Hope it helps!!

If you can open then word file before executing the bot then open it and click on B bold on ribbon and use ctrl + s and close the word and after that execute it but if you want to execute some part of your text than go through with this

if this solution is correct then please mark it as solution

Happy Automation

@kshitij.bhatnagar

Please check that answer, That was for Word.
We can use vba for word/ excel also.

Happy Automation

It’s a whole detour but works, use a excel template, and convert the excel to pdf at end.
You can copy the excel template from one you premade, and determine then what cells needs to be bold, and add that style, any item added in that cell will then have the pre-defined style.