I work with macros in Word. The input to the macro is a data set that may contain an RTF object. It could be plain text, a table or an image (maybe something else, but that’s what I’m focusing on). I’ve tried inserting RTF as is, but that just inserts the encoded string ({rtf1 and all…) into the document.
Sub InsertSPElement(iRow, arrTables)
Dim text, full_text As String
text = arrTables(iRow, 8)
full_text = arrTables(iRow, 10) ' RTF String
With Selection
If StrComp(arrTables(iRow, 6), "Important", 1) = 0 Then
.InsertAfter text:=text
.Font.Bold = True
'.Range.SetListLevel Level:=CInt(arrTables(iRow, 3))
.Style = ActiveDocument.Styles("Header " & arrTables(iRow, 3))
.InsertParagraphAfter
.Collapse Direction:=wdCollapseEnd
If Len(full_text) > 0 Then
.InsertAfter text:=full_text
.Font.Bold = False
.InsertParagraphAfter
.Collapse Direction:=wdCollapseEnd
End If
End If
End With
End Sub
Is it possible to somehow take a string from rtf and transform it into something that it originally was, working only through a macro? I don’t have access to the document call because it happens through a third party application
I tried just put rtf-string through .InsertAfter, but it don’t work at all
Ivan Serdukov is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.