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 16-10-2007, 20:56
knowbodynow knowbodynow is offline
Senior Member
 
Join Date: Mar 2006
Location: Hatsukaichi near Hiroshima
Posts: 431
Default Changing Selected text

Hello,

I'm looking for a way to change all selected characters to the underscore symbol except for spaces (chr32)). I've drawn a complete blank on this. Here is my closest try. It doesn't work, I think because I can't maintain the shaperange:

Code:
sub changeselected()

Dim s as shape
Dim t1 As TextRange
Dim i As Integer, c As Integer


Set s = ActiveShape

c = s.text.Selection.Characters.Count

i = 1

While i < c
  Set t1 = s.text.Selection.Characters(i)
  If t1 <> Chr(32) Then
     s.text.replace t1, "_", True, ReplaceAll:=False
  End If
  i = i + 1
Wend
Also I suspect the s.text.replace is wrong as it will change any character and not just a selected one but s.text.selection.replace did nothing.

I'm probably approaching this all wrong, hence this post. Can anyone please set me on the right path.

Thanks,

Chris (Hunt)
Reply With Quote
  #2  
Old 17-10-2007, 02:01
shelbym's Avatar
shelbym shelbym is offline
Senior Member
 
Join Date: Nov 2002
Location: Cheyenne, WY
Posts: 1,770
Blog Entries: 10
Send a message via ICQ to shelbym Send a message via AIM to shelbym Send a message via MSN to shelbym Send a message via Yahoo to shelbym
Default Duplicate

Chris I believe you have asked this before and Alex was kind enough to provide a solution. See this post: http://forum.oberonplace.com/showpos...64&postcount=6

Best of luck,

-Shelby
Reply With Quote
  #3  
Old 17-10-2007, 08:49
knowbodynow knowbodynow is offline
Senior Member
 
Join Date: Mar 2006
Location: Hatsukaichi near Hiroshima
Posts: 431
Default

Thanks, Shelby, you are correct. I've bookmarked the page now. I did a search and couldn't find anything and then couldn't remember. I have the code working now.

Cheers,

Chris
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 15:14
Changing Colour of Characters in Artistic text knowbodynow CorelDRAW/Corel DESIGNER VBA 3 06-05-2006 19:43
Changing text size in CD12 knowbodynow CorelDRAW/Corel DESIGNER VBA 10 07-03-2006 07:13
Where is the selected text? petig CorelDRAW/Corel DESIGNER VBA 7 16-05-2005 15:30
Reading Font Properties from selected text in CD9 sherman01 CorelDRAW/Corel DESIGNER VBA 2 24-11-2004 07:59


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


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