?
Solved

OLE messaging - Word and Text Controls

Posted on 1998-11-23
7
Medium Priority
?
241 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
Independent Software Vendors: 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 200 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

Tech or Treat!

Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.

Question has a verified solution.

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

You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
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 process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

649 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