Line added to pasted richtext in Word using VB
Posted on 2006-10-22
I have a VB application that builds a report in Word. The program grabs text from a database and pastes it into a Word bookmark. The text is richtext in nature. It all works like a charm except when it is pasted into Word it adds a line, not sure if it is a carriage return or line feed or what, but the results is that an extra line is always added. Here is the code that does the grabbing and the putting...
Case Is = "Memo"
frmMain.Controls(MyMemoField).SelStart = 0
frmMain.Controls(MyMemoField).SelLength = Len(frmMain.Controls(MyMemoField).TextRTF)
Clipboard.SetText frmMain.Controls(MyMemoField).SelRTF, vbCFRTF
That little extra line is messing up a realy nice report otherwise. Any ideas on where it is coming from or how to get rid of it would be greatly appreciated.