OberonPlace.com Forums  

Go Back   OberonPlace.com Forums > Developer Forums > VBA > CorelDRAW/Corel DESIGNER VBA

Thread Tools Search this Thread Display Modes
Old 21-04-2007, 12:40
Posts: n/a
Default Odd square characters

Does anyone know how to get rid of those odd looking rectangular-squarish characters in text strings?

On active layer I have paragraph text that I wish to process using vb string functions. But, when I do something like:

Dim sTemp As String
sTemp = s.Text.Story.Characters.All

sTemp is fill with a string of printing and non-printing characters represented by "[]" rectangles.

I assume they're printing instructions (new line, new paragraph, spacing) and I need to convert string to ASCII, but I don't know how to get that done.


p.s. What an awesome forum!

Last edited by Beatniks; 21-04-2007 at 16:04.
Reply With Quote
Old 21-04-2007, 19:46
wOxxOm's Avatar
wOxxOm wOxxOm is offline
Senior Member
Join Date: Mar 2005
Posts: 836

I would replace formatting codes by builtin VBA 'replace' function

s=replace(s,vbCr," ")
s=replace(s,vbLf, " ")
s=replace(s,chr(11), " ") 'softreturn

'.......or in one line:
s=replace(replace(replace(Shape1.Text.Story.Text,vbCr," "),vbLf, " "),chr(11), " ")
Reply With Quote
Old 23-04-2007, 14:19
Posts: n/a

Thank You!
Reply With Quote
Old 23-04-2007, 17:45
Posts: n/a
Default Missing one character

The code above removed most characters, but there was still a few that needed to be identified before I could get rid of them. The following code accomplished that:

sBadCharacter = Mid(st, 27, 1) ' This gets the twenty-seventh character, which was the bugger!
sBadCharacterNumber = Asc(sBadCharacter) ' This tell me the character number

Now, put this in the removal lines...
st = Replace(st, Chr(sBadCharacterNumber), " ") or

st = Replace(st, Chr(9), " " )
Reply With Quote
Old 23-04-2007, 22:38
Alex's Avatar
Alex Alex is offline
Join Date: Nov 2002
Posts: 1,940
Blog Entries: 4

Well, if you know that it's the 27th character that is a problem, you can easily replace it directly:

Mid(st, 27, 1) = " "
Reply With Quote

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Striping a word down to the first letter only knowbodynow CorelDRAW/Corel DESIGNER VBA 9 19-04-2007 15:14
fading box from color to transparent DalePurdon General 6 08-12-2006 15:47
Changing Colour of Characters in Artistic text knowbodynow CorelDRAW/Corel DESIGNER VBA 3 06-05-2006 19:43
Text ENCODE Craig Tucker CorelDRAW/Corel DESIGNER VBA 10 26-01-2005 13:59
Special Characters Craig Tucker CorelDRAW/Corel DESIGNER VBA 3 12-03-2003 11:57

All times are GMT -5. The time now is 01:11.

Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2022, Jelsoft Enterprises Ltd.
Copyright © 2011, Oberonplace.com