We need to move rich text from an Access memo field to a Word text box. So far the best I’ve been able to come up with is in the code below. In this code “pprs!What is a record set field of a table memo field that is bound to a text box enabled for rich text. The rich text seems to be stored as html as so I can get word to convert it by enclosing it in html tags. This seems to work ok but I’d rather do this more directly than this kludge of writing and reading a file. Any ideas?
Dim What As Word.Shape
Set What = doc.Shapes.AddTextbox(msoTextOrientationHorizontal, doc.PageSetup.LeftMargin, 225, 534, 0)
Dim sPath As String
sPath = "G:\Temp.html"
Open sPath For Output As 1
Print #1, "<HTML>" & pprs!What & " </HTML>"
Close #1
What.TextFrame.TextRange.InsertFile (sPath)
Dim What As Word.Shape
Set What = doc.Shapes.AddTextbox(msoTextOrientationHorizontal, doc.PageSetup.LeftMargin, 225, 534, 0)
Dim sPath As String
sPath = "G:\Temp.html"
Open sPath For Output As 1
Print #1, "<HTML>" & pprs!What & " </HTML>"
Close #1
What.TextFrame.TextRange.InsertFile (sPath)