2

With VBA you can mark a part of the text bold like this:

Sub Makro1()
    ActiveCell.FormulaR1C1 = "test test test test test"
    With ActiveCell.Characters(Start:=1, Length:=6).Font
        .FontStyle = "Standard"
    End With
    With ActiveCell.Characters(Start:=7, Length:=7).Font
        .FontStyle = "Fett"
    End With
    With ActiveCell.Characters(Start:=14, Length:=6).Font
        .FontStyle = "Standard"
    End With
End Sub

But how can I do it in Office Scripts? I have only found something like this. But here the whole cell is marked in bold.

function main(workbook: ExcelScript.Workbook) {
    let selectedSheet = workbook.getActiveWorksheet();
    selectedSheet.getRange("B4").getFormat().getFont().setBold(true);
}

I have tried this.

function main(workbook: ExcelScript.Workbook) {
    let selectedSheet = workbook.getActiveWorksheet();
    selectedSheet.getRange("B4").getFormat().getFont().setBold(true);
}

But I only want to mark a part of the text in bold.

Brian Gonzalez
  • 1,178
  • 1
  • 3
  • 15
  • I think the simple answer is that you can't. If you record a script, it too doesn't give you any code that performs the task you're after. – Skin Mar 07 '23 at 23:21

0 Answers0