Solved

OLE messaging - Word and Text Controls

Posted on 1998-11-23
7
227 Views
Last Modified: 2008-03-06
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?
0
Comment
Question by:mags_12
7 Comments
 

Author Comment

by:mags_12
ID: 1446353
Edited text of question
0
 
LVL 1

Expert Comment

by:csalves
ID: 1446354
Try to change the font for trueType font...
bye,
0
 

Author Comment

by:mags_12
ID: 1446355
Edited text of question
0
Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 

Author Comment

by:mags_12
ID: 1446356
True Type fonts are used in both the text control and the word document in which the spell-check is undertaken
0
 
LVL 1

Expert Comment

by:mmahdi
ID: 1446357
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
0
 

Author Comment

by:mags_12
ID: 1446358
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!
0
 
LVL 1

Accepted Solution

by:
bear454 earned 100 total points
ID: 1446359
Use a RichTextBox instead of Textbox - there is better cross-compatibility in structure between Word and RTB than textbox.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

820 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question