Reading Wordpad - Rich Text Format

B

Braindeadbeachbum

Hey Guys

I need to read a Worpad format in Excel.

I depend on a wordpad app to input text to a SQL database. I then read the
text field from the DB via ADO into Excel using nvarchar for the text field
as this is RTF. The text I get back looks like the following:

=====================================================================
{\rtf1\ansi\ansicpg1252\deff0{\fonttbl{\f0\fnil MS Sans
Serif;}{\f1\fnil\fcharset0 MS Sans Serif;}{\f2\fswiss\fprq2\fcharset0 Arial;}}

{\colortbl ;\red0\green0\blue0;}

\viewkind4\uc1\pard\cf1\lang1033\f0\fs20 SPOKE RIETTE AND INFORMED HER THAT
CALLS WERE LOGGED INCORRECTLY I GAVE HER A NUMBER TO HELP HER OUT


\par

\par THE PRINTER IS FAULTY

\par \f1 called and confirmed with the user that the call can be closed.

\par \f2\fs18

\par }
=====================================================================

All I want is the actual text:

=====================================================================
SPOKE RIETTE AND INFORMED HER THAT CALLS WERE LOGGED INCORRECTLY I GAVE HER
A NUMBER TO HELP HER OUT

THE PRINTER IS FAULTY
called and confirmed with the user that the call can be closed.

=====================================================================

I know it’s a long shot but is there any way I can format the field within
Excel to read Rich Text Format?

Please help!
 
A

AA2e72E

All I want is the actual text:

One way to achieve this is to put a RichTextBox control on a userform.

Read your WordPad document as follows:

userform1.RichTextBox1.FileName= "C:\Document.rtf"


Get the text only from the control as follows:

RTFText = userform1.RichTextBox1.text
 
B

Braindeadbeachbum

Hi AA2e72E

I use a ADO recordset to import the date from SQL and do not go through
every record as it's alot of data. The code I currently use to dump the
recordset in Excel is: Range("A2").CopyFromRecordset rstRecordSet

I also clear the worksheet before import: ActiveSheet.Cells.Clear

I might be able to use you suggestion if I used a "Do untill EOF" and edited
one record at a time but this will slow my query down to much.

Any other ideas?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top