![]() |
#1
|
|||
|
|||
![]()
Awhile back Shelby gave this code for pasting an object at nodes, which is perfect if you have only one object to paste:
Code:
Sub PasteClipboardAtNodes() Dim s As Shape, sr As ShapeRange Dim sclip As Shape, n As Node Set sr = ActiveSelectionRange ActiveDocument.ReferencePoint = cdrCenter Set sclip = ActiveLayer.Paste For Each s In sr If s.Type = cdrCurveShape Then For Each n In s.Curve.Nodes sclip.Duplicate.SetPosition n.PositionX, n.PositionY Next n End If Next s sclip.Delete End Sub Ideally I would like to choose whether it pastes using the object center or its left, right, top or bottom center. Or maybe it could "respect" the relative center chosen (or object origin) prior to running the macro. Can this be done? Patti |
#2
|
|||
|
|||
![]()
Sounds like something that I should add to this little docker I'm working on...
But back to your question - this is certainly doable. Adding the origin points and such instantly inflate the amount of work, but in general you would have to define a ShapeRange instead the single sclip shape, then define an index to set the amount of shapes. Like this: Code:
Sub PasteClipboardAtNodes() Dim s As Shape, sr As ShapeRange Dim sclip As ShapeRange, n As Node Dim Index As Integer Set sr = ActiveSelectionRange ActiveDocument.ReferencePoint = cdrCenter Set sclip = ActiveLayer.PasteEx Index = 1 For Each s In sr If s.Type = cdrCurveShape Then For Each n In s.Curve.Nodes sclip.Shapes(Index).Duplicate.SetPosition n.PositionX, n.PositionY If Index < sclip.Shapes.Count Then Index = Index + 1 Else Index = 1 Next n End If Next s sclip.Delete End Sub EDIT: The PasteEx is important (I pasted a version without it), since it returns a range instead of a single shape. Last edited by Joe; 24-05-2012 at 14:50. |
![]() |
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 |
Copy and paste as new document | hvw | Corel Photo-Paint VBA | 2 | 01-02-2012 06:42 |
Paste special | aakkaarr | CorelDRAW/Corel DESIGNER VBA | 3 | 22-04-2011 17:42 |
Paste to fit within page | PAnderson | CorelDRAW/Corel DESIGNER VBA | 4 | 12-08-2010 16:25 |
Wireframe vs. Enhanced View | bprice | CorelDRAW/Corel DESIGNER VBA | 2 | 19-01-2009 07:11 |
Delete Segment Enhanced | Hernán | New product ideas | 1 | 08-12-2003 16:04 |