Solved

OLE messaging - Word and Text Controls

Posted on 1998-11-23
7
219 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
Comment Utility
Edited text of question
0
 
LVL 1

Expert Comment

by:csalves
Comment Utility
Try to change the font for trueType font...
bye,
0
 

Author Comment

by:mags_12
Comment Utility
Edited text of question
0
What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

 

Author Comment

by:mags_12
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
Use a RichTextBox instead of Textbox - there is better cross-compatibility in structure between Word and RTB than textbox.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
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…

762 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

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now