OberonPlace.com Forums  

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

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 21-04-2007, 13:40
Beatniks
Guest
 
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.

Thanks

p.s. What an awesome forum!

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

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

Code:
s=Shape1.Text.Story.Text
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
  #3  
Old 23-04-2007, 15:19
Beatniks
Guest
 
Posts: n/a
Default

Thank You!
Reply With Quote
  #4  
Old 23-04-2007, 18:45
Beatniks
Guest
 
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
  #5  
Old 23-04-2007, 23:38
Alex's Avatar
Alex Alex is offline
Administrator
 
Join Date: Nov 2002
Posts: 1,940
Blog Entries: 4
Default

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

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


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 16:14
fading box from color to transparent DalePurdon General 6 08-12-2006 16:47
Changing Colour of Characters in Artistic text knowbodynow CorelDRAW/Corel DESIGNER VBA 3 06-05-2006 20:43
Text ENCODE Craig Tucker CorelDRAW/Corel DESIGNER VBA 10 26-01-2005 14:59
Special Characters Craig Tucker CorelDRAW/Corel DESIGNER VBA 3 12-03-2003 12:57


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


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