Solved

OLE messaging - Word and Text Controls

Posted on 1998-11-23
7
229 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
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…

739 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