UtterAccess.com
We have detected that you are using an unsupported web browser. We recommend you to upgrade your web browser to get the most from UtterAccess forums.
Why should and how can I upgrade?
X   Site Message
(Message will auto close in 2 seconds)

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Using Vba To Copy Rich Text Cell Data From Word Table To Ado Recordset Field    
 
   
afterburner272
post Mar 15 2011, 12:17 PM
Post #1

New Member
Posts: 14



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
Go to the top of the page
 
+
danishani
post Mar 19 2011, 01:09 PM
Post #2

UtterAccess VIP
Posts: 4,162
From: Washington, USA



Hi Don,
welcome2UA.gif
You might take a look into using Word Forms to Access tables by MSDN.
HTH,
Daniel
Go to the top of the page
 
+
afterburner272
post Mar 21 2011, 12:51 PM
Post #3

New Member
Posts: 14



Daniel,
Thanks for the link! Unfortunately, it did not yield any clues for solving my problem.
Big picture, I am trying to extract requirements out of a document in MS Word, so I am stuck with the format of the Word document, so the fields trick won't work in my situation.
Fundamentally, I think the crux of the problem is along the lines of a type mismatch problem. While MS Access allows me to mark the memo field reqText as rich text, either the record set does not "recognize" that fact and just assigns the viewable text or the VBA is somehow doing a type conversion and shouldn't be. Further, I am not even sure I am using the correct attribute for access the cell to get the rich text except for .Copy. But then I have the problem of figuring out how then to past to the recordset field!
Based on the lack of responses, I must be way out in left field with this. I would have thought someone has already done or run across something similar.
Thanks again!
Don
Go to the top of the page
 
+
danishani
post Mar 21 2011, 01:36 PM
Post #4

UtterAccess VIP
Posts: 4,162
From: Washington, USA



Hi Don,
Well, the link I provide is more like a nice way to Use Word Forms to link with Access tables.
Maybe this link will help you further to pursue your goal.
HTH,
Daniel
Go to the top of the page
 
+
afterburner272
post Mar 21 2011, 02:38 PM
Post #5

New Member
Posts: 14



Daniel,
Looking at the referenced page, it has already given me a couple of hints as to what to look for next. Most noteably the CR/CRLF issue. I am actually trying to preserve formating that includes bullets and indenting, and there is a note in the article about that capability not being explicitly included. However, and a bit of a kludge, the article got be thinking that I can maybe to a rich text to pretty formatted plain text on the fly. Ie convert CR to CRLF; bullets to "*" and add tabs and spaces where appropriate. Not as slick as just using the rcih text, but would get things moving!
Thanks!
Don
Go to the top of the page
 
+
danishani
post Mar 21 2011, 03:04 PM
Post #6

UtterAccess VIP
Posts: 4,162
From: Washington, USA



Hi Don,
Glad I could help your further! Goodluck! <
Cheers,
Daniel
Go to the top of the page
 
+

Thank you for your support! Reply to this topicStart new topic

Jump To Forum:
 



RSS Search  ·  Go to Top  ·  Lo-Fi Version Time is now: 27th August 2014 - 12:05 PM