Using VBA to Copy Rich Text Cell Data from Word Table to ADORecordset Field

  • Thread starter Thread starter Don
  • Start date Start date
D

Don

Here is a snippet of code I am working on to copy the rich text
contents of a Word table cell to a field of an an open recordset:

intRowCount = 1
While intRowCount <= intNumRows
strReqNumber =
docNew.Tables(intTableCount).Cell(intRowCount, 1).Range.Text
rstReq.AddNew
rstReq![ReqName] = Trim(strReqNumber)

'**** Next line successfully gets the rich text to the
clipboard
docNew.Tables(intTableCount).Cell(intRowCount,
2).Range.Copy

'**** Have tried both .Text and .FormattedText
rstReq![ReqText] =
docNew.Tables(intTableCount).Cell(intRowCount, 2).Range.FormattedText
'**** Need to get rstReq![ReqText] to accept the formatted
text or find a way to past the clipboard data

rstReq.Update

intRowCount = intRowCount + 1
Wend

The table field, ReqText, is set as rich text in the table definition
and I can manually cut-'n-paste rich text into the table fine.
Fundamentally, my problem appears to revolve around setting the filed
value with ADO.

Any suggestions will be greatly appreciated!

Thanks!

Don
 
Back
Top