Getting Text from Richtext

P

PC User

I'm using the voice reader from a db demo that I made and putting it
into a db that has richtext. I'm made a public function that reads the
text; however, when it reads richtext it reads all the format codes as
well as the content text. I need to be able to have it read the text of
the richtext and not include the format codes.

Code:
Public Function Speak()
'On Error Resume Next
'See Voice Declaration Module - basVoiceDeclarations
Dim ctlText As Control
Set ctlText = Screen.PreviousControl
Set V = New SpVoice
V.Speak Nz(ctlText, "")
End Function

The voice reader demo is at
http://www.access-programmers.co.uk/forums/attachment.php?attachmentid=14484&d=1155079291

Any help would be appreciated.

Thanks,
PC
 
D

Douglas J. Steele

What RTF control are you using? I believe most of them should have a
property that returns strictly the text, with no formatting codes.
 
P

PC User

I'm aware of the Text property to convert richtext into text; however,
if you look at my code you can see my problem. The code refers to the
previous control and does not recognize it as a richtext box. I'm sure
if you look at the sample db of the use of a textbox it will be clearer
as to what I'm asking. Put a richtext box in its place and the voice
function reads the formatting codes and the text content. Using the
code for the voice controls, how can I use the Text property of the
richtext activex control?

Thanks,
PC
 
D

Douglas J. Steele

I don't understand what you mean that it "does not recognize it as a
richtext box". Does it pick the correct control? (Check by looking at
ctlText.Name). Have you tried using V.Speak Nz(ctlText.Text, "")? (Note
that you might need to set focus on the control first)
 

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