Link to home
Start Free TrialLog in
Avatar of mags_12
mags_12

asked on

OLE messaging - Word and Text Controls

I'm using VB5 and invoking Word 7 - Windows 95 (via the OLE messaging interface) in order to spell-check the contents of a text box at run-time. When the text is returned from Word - and assigned to the text box text property - sometimes (not always) the CR or TAB characters are displayed as square boxes. (I've checked that these are CR or TAB characters using the debugger). What's going on?
Avatar of mags_12
mags_12

ASKER

Edited text of question
Try to change the font for trueType font...
bye,
Avatar of mags_12

ASKER

Edited text of question
Avatar of mags_12

ASKER

True Type fonts are used in both the text control and the word document in which the spell-check is undertaken
Mags_12,

Why not check for the last character on the text box in the TEXT_CHANGE event, and if last char is not TAB or CR then remove it. You can use the following function to remove non-alpha/numeric char from a string.

Public Function RemoveTABorCR(WHATSTRING As String) As String

Dim iCnt As Integer
SOMESTR = WHATSTRING
For iCnt = 1 To Len(SOMESTR)
    If iCnt > Len(SOMESTR) Then Exit For
    If Asc(Mid(SOMESTR, iCnt, 1)) < 32 Or Asc(Mid(SOMESTR, iCnt, 1)) > 126 Then
        SOMESTR = Left(SOMESTR, iCnt - 1) & Right(SOMESTR, Len(SOMESTR) - iCnt)
    End If
Next iCnt
If Asc(Right(SOMESTR, 1)) = 13 Or Asc(Right(SOMESTR, 1)) = 8 Or Asc(Right(SOMESTR, 1)) = 9 Or Asc(Right(SOMESTR, 1)) = 10 Then SOMESTR = Left(SOMESTR, Len(SOMESTR) - 1)
RemoveTABorCR = SOMESTR

To call the function you would type: RemoveTABorCR(TEXT1.TEXT)

I hope this would help


Baltaz13
Avatar of mags_12

ASKER

Thanks very much for your reply mmahdi but I actually want to retain the original formatting (CR or TAB) as eventually the text in this control is put into a Word document and printed or e-mailed.

I just don't want the CRs & Tabs to appear as squares when they are returned from the Word spell-checker!
ASKER CERTIFIED SOLUTION
Avatar of bear454
bear454

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial