![]() |
#1
|
|||
|
|||
![]()
Hello! First post here.
Started trying to make my own VBA macros just yesterday to ease a specific task (importing a bunch of CAD drawings, resizing all of them by a percentage, etc) and have already snowballed out of control by making a crazy toolbox: ![]() Yes, it's something only a father would love ![]() Anyways, a question: I'd like to select a bunch of things on a page and then just press a button like "Top Left" to set the Alignment of Text (You can see this in the sort-of Joystick like thing next to the "Insert text" button). My code is such: Code:
For Each Current In ActiveSelectionRange Current.Text.Frame.VerticalAlignment = cdrTopJustify Current.Text.Selection.Alignment = cdrLeftAlignment Next Current I realize some check is needed, but really can't find how to do it. This forum has already helped with the Alignment settings, hopefully this can be solved as well. Thanks! Edit: D'oh! With all this typed up I click "New posts" and bam! This one already has the necessary check visible: Code:
For Each Current In ActiveSelectionRange If Current.Type = cdrTextShape Then Current.Text.Frame.VerticalAlignment = cdrTopJustify Current.Text.Selection.Alignment = cdrLeftAlignment End If Next Current Last edited by Joe; 06-11-2008 at 06:53. |
#2
|
|||
|
|||
![]() Quote:
|
#3
|
|||
|
|||
![]()
Now that looks rather nice, thanks!
And another question has popped up, this one may be a little weird. I would like to select a bunch of complex shapes and simple rectangles. We can assume that every complex shape resides within the rectangle. The task would be to somehow find the shape and its rectangle and then align the shape to the rectangle. I can handle the alignment, finding the rectangle "under" is what seems damn hard. Any ideas? |
#4
|
||||
|
||||
![]()
Just name the shape and find it by its name.
Code:
Set s = ActivePage.FindShape(Name:="MyShapeName") Code:
Sub MySelection() Dim s As Shape, sFound As Shape Dim x As Double, y As Double, w As Double, h As Double ActiveDocument.ReferencePoint = cdrBottomLeft Set s = ActivePage.FindShape(Name:="MyShapeName") s.GetPosition x, y s.GetSize w, h Set sFound = ActivePage.SelectShapesFromRectangle(x, y, x + w, y + h, False) End Sub -Shelby |
#5
|
|||
|
|||
![]()
Thanks! Noticed that I wasn't clear enough when defining the task as each complex shape would have its own rectangle. But that's ok, found a way to overcome this in a way and this reply helps with another idea I have been having.
And with that another question - I'm trying to implement a selection buffer of sorts - say, select your shapes, click the button and it marks them. Then later you just click another button and all your special shapes get selected. When you decide to create a new selection group or click a, say "Remove selection group" button it would remove all the shapes from the selection ring. The approach I had in mind was going through the given shapes and adding a tag of sorts, say "Sel1" followed by the shape name so that the tag can be removed later. And then selecting the shapes based on their tags. But then doing something like CurrentShape.Name = "Tag1 " & CurrentShape.Name only produces "Tag1" as the name of the shape. Any ideas about this? And on another note couldn't get the nice looking code identer to work - on CorelDraw X4 and Windows Vista no matter what. Any other suggestions? (Surprisingly google helps very little with this). Edit: Gonna add a pic here to illustrate the selection idea, this should explain it better: ![]() Last edited by Joe; 02-11-2008 at 04:21. |
#6
|
||||
|
||||
![]()
Instead of storing your tag in the name, try using Shape.Properties. Also Alex has already written something very similar to this, you might want to check it out.
Oberon Selection Manager Best of luck, -Shelby |
#7
|
|||
|
|||
![]()
Thanks for the lead, gonna check both out.
I realize that there will be several macros which have similar or the same functionality, but would like to put everything that's useful in one panel that can just hang around there and ease all these things which need to be done so often (of course these things differ depending on your approach, hence Joe's toolbox ![]() So far it has already really made life easier, and learning VBA is pretty fun so it's all good. |
#8
|
|||
|
|||
![]()
Yet another possibly stupid question - would like to implement such a thing: You have a selection, press a button and only the text shapes (or vice versa) within that selection get selected. Tried some things, but no cigar. It's a shame that something like:
Code:
ActivePage.FindShapes(Type:=cdrTextShape).AddToSelection Code:
ActiveSelectionRange.FindShapes(Type:=cdrTextShape).AddToSelection And another one - For example there is a shape, a rectangle is drawn around it and then I'd like to group them together. Always use something like: Code:
For Each Current In ActiveSelectionRange 'My Code Next Current And sounds like if something decent comes out of this I'll have to give half the credit to Shelby ![]() |
![]() |
Tags |
text |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Select All Text On a Layer | knowbodynow | CorelDRAW/Corel DESIGNER VBA | 2 | 24-05-2007 21:08 |
Dimension presets affect line endpoint default | corel designer whiner | Feature requests/wishlist | 0 | 28-06-2006 14:17 |
Select specified text, change font size? | fiddler2b | CorelDRAW/Corel DESIGNER VBA | 3 | 23-04-2006 09:11 |
Select Paragraph Text with more than one color | joexx | CorelDRAW/Corel DESIGNER VBA | 2 | 06-10-2004 13:20 |
Select All | ddonnahoe | CorelDRAW/Corel DESIGNER VBA | 4 | 10-02-2004 10:14 |