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 15-01-2011, 06:15
pithe pithe is offline
Junior Member
 
Join Date: Aug 2009
Location: Hungary
Posts: 18
Send a message via Skype™ to pithe
Default Find and replace text, and only changed the Scale

My code:

Sub Szöveg_csere()
ActiveDocument.Unit = cdrMillimeter
ActiveDocument.ReferencePoint = cdrCenter
Dim s As Shape, n As Long, sr As ShapeRange
Dim x As Double, y As Double, w As Double, h As Double
Set sr = ActiveSelection.Shapes.FindShapes(, cdrTextShape)
For Each s In sr

s.Text.Replace "TEXT1", "TEXT2TEXT2", True, ReplaceAll:=True
'every selected text resize, but not only TEXT1
s.GetPosition x, y
s.GetSize w, h
s.SetSizeEx x, y, 111, h

Next s

End Sub

Please Help!
Reply With Quote
  #2  
Old 15-01-2011, 09:03
runflacruiser's Avatar
runflacruiser runflacruiser is offline
Senior Member
 
Join Date: Jun 2009
Location: Pigeon Forge, TN USA
Posts: 811
Default

Hi.
You're looking for shapes in the active selection. Are you sure you have something selected?
If you want to process all shapes then use:

Code:
Set sr = ActivePage.Shapes.FindShapes(, cdrTextShape)
-John
Reply With Quote
  #3  
Old 15-01-2011, 09:27
pithe pithe is offline
Junior Member
 
Join Date: Aug 2009
Location: Hungary
Posts: 18
Send a message via Skype™ to pithe
Default

Here is the text of all resize. I would like to have only exchanged text resize.
Attached test file.
Attached Files
File Type: cdr Text1-Text2Text2.cdr (23.7 KB, 368 views)
Reply With Quote
  #4  
Old 15-01-2011, 10:04
runflacruiser's Avatar
runflacruiser runflacruiser is offline
Senior Member
 
Join Date: Jun 2009
Location: Pigeon Forge, TN USA
Posts: 811
Default

Hi.
Try the get and set bounding box but you have to get the size first before you change it:

Code:
Sub Szöveg_csere()

ActiveDocument.Unit = cdrMillimeter
ActiveDocument.ReferencePoint = cdrCenter
Dim s As Shape, n As Long, sr As ShapeRange
Dim x As Double, y As Double, w As Double, h As Double

Set sr = ActivePage.Shapes.FindShapes(, cdrTextShape)
For Each s In sr
    s.GetBoundingBox x, y, w, h
    s.Text.Replace "TEXT1", "TEXT2TEXT2", True, ReplaceAll:=True
    s.SetBoundingBox x, y, w, h

Next s

End Sub
-John
Reply With Quote
  #5  
Old 15-01-2011, 10:42
pithe pithe is offline
Junior Member
 
Join Date: Aug 2009
Location: Hungary
Posts: 18
Send a message via Skype™ to pithe
Default

This solution would be good if the same size as the original, but if I can resize the text then you have to implement all of the text. How to achieve it, only that the search / replace text, do the scaling?
Reply With Quote
  #6  
Old 15-01-2011, 10:53
runflacruiser's Avatar
runflacruiser runflacruiser is offline
Senior Member
 
Join Date: Jun 2009
Location: Pigeon Forge, TN USA
Posts: 811
Default

Hi.
I thing this is what you mean:

Code:
Sub Szöveg_csere()

ActiveDocument.Unit = cdrMillimeter
ActiveDocument.ReferencePoint = cdrCenter
Dim s As Shape, n As Long, sr As ShapeRange
Dim x As Double, y As Double, w As Double, h As Double

Set sr = ActivePage.Shapes.FindShapes(, cdrTextShape)
For Each s In sr
    If s.Text.Story.Characters.All = "TEXT1" Then
        s.GetBoundingBox x, y, w, h
        s.Text.Replace "TEXT1", "TEXT2TEXT2", True, ReplaceAll:=True
        s.SetBoundingBox x, y, w, h
    End If

Next s
-John
Reply With Quote
  #7  
Old 15-01-2011, 12:04
pithe pithe is offline
Junior Member
 
Join Date: Aug 2009
Location: Hungary
Posts: 18
Send a message via Skype™ to pithe
Default

It will be so good. The Bounding Boxes referencepoint how to change?
ActiveDocument.ReferencePoint = cdrCenter is NOT.
s.SetBoundingBox x, y, 110, h,, cdrCenter is NOT.

Center text aligment is s.SetBoundingBox x, y, 110, h,, cdrCenter
bottomleft and I think the reference point. How to select reference point?
Reply With Quote
  #8  
Old 15-01-2011, 15:18
runflacruiser's Avatar
runflacruiser runflacruiser is offline
Senior Member
 
Join Date: Jun 2009
Location: Pigeon Forge, TN USA
Posts: 811
Default

Hi.
I'm not 100% clear on what you mean but...
You would have to calculate the center like

x + w/2

-John
Reply With Quote
  #9  
Old 20-01-2011, 15:47
pithe pithe is offline
Junior Member
 
Join Date: Aug 2009
Location: Hungary
Posts: 18
Send a message via Skype™ to pithe
Default

Thanks for your help!
Now we have solved the problem with your help. I am very thankful for it!
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
Find/Replace Text in Multiple Open Documents jfelder Macros/Add-ons 6 20-01-2009 13:20
Find all text and apply text style keytecstaff CorelDRAW/Corel DESIGNER VBA 2 18-05-2006 10:48
Scale a group with text frame daniello Macros/Add-ons 3 21-03-2006 15:54
Find and Replace Text with Form RVogel CorelDRAW/Corel DESIGNER VBA 1 24-03-2005 10:37
Find/Replace with CorelDraw 9 and VB 6 sfldan CorelDRAW/Corel DESIGNER VBA 1 10-07-2003 18:44


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


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