I think that the modification made on the previous link may correspond to your needs
'This example shows how to get the values of the dimensions in a drawing.
'---------------------------------------------------------------------------
' Preconditions:
' 1. Open a drawing document.
' 2. Open the Immediate window.
'
' Postconditions: Inspect the Immediate window.
'---------------------------------------------------------------------------
Option Explicit
Sub main()
Dim swApp As SldWorks.SldWorks
Dim swModel As SldWorks.ModelDoc2
Dim swDraw As SldWorks.DrawingDoc
Dim swView As SldWorks.View
Dim swDispDim As SldWorks.DisplayDimension
Dim swDim As SldWorks.Dimension
Dim swAnn As SldWorks.Annotation
Dim swModelDocExt As SldWorks.ModelDocExtension
Dim boolstatus As Boolean
Set swApp = Application.SldWorks
Set swModel = swApp.ActiveDoc
Set swDraw = swModel
'Debug.Print "File = " & swModel.GetPathName
Set swView = swDraw.GetFirstView
Do While Not swView Is Nothing
'Debug.Print' View = ' & swView.Name
Set swDispDim = swView.GetFirstDisplayDimension5
Do While Not swDispDim Is Nothing
Set swAnn = swDispDim.GetAnnotation
Set swDim = swDispDim.GetDimension
Debug.Print " DimFullName = " & swDim.FullName
Debug.Print " Value = " & swDim.GetSystemValue2("")
Debug.Print " CalloutBelow = " & swDispDim.GetText(swDimensionTextCalloutBelow)
Set swModelDocExt = swModel.Extension
boolstatus = swModel.Extension.SelectByID2(swDim.FullName, "DIMENSION", 0, 0, 0, False, 0, Nothing, 0)
boolstatus = swModelDocExt.EditDimensionProperties(0, 0, 0, "", "", True, 9, 2, True, 1, 1, "", "", True, "", "Text to replace", "", True, swThisConfiguration, "")
swModel.ClearSelection2 True
Set swDispDim = swDispDim.GetNext3
Loop
Set swView = swView.GetNextView
Loop
End Sub
It's up to you to put conditions to put the corresponding text