![]() |
#1
|
|||
|
|||
![]()
Hello
I hope my english will be good enough to explain, what I would like to do... I have a VBA Macro that takes some Shapes out of the Clipboard, ungroups them, changes the outlinewidth, applys 'nofill' after pasting it into Coreldraw. The Problem is, that after changing the outlinewidth these Shapes don't fit together anymore, there are various, different Gaps between them. If I take a Corner-Node with the Mouse and put them together with the near by Shapes-Corner-Node the Shapes where catched together. Because the Gaps and the Sizes of the Shapes are different it is not posible to move the shapes with a fixed Value. Is there any possibility to move the shapes to 'node on node' by VBA? Would be realy nice if anybody has any tipps for me. Regards Werner Last edited by WernerHo; 14-02-2017 at 06:01. |
#3
|
|||
|
|||
![]()
Hi Shelby
thank you for your Post. I read it a little late, so my answer comes late... I attached a .cdr with an example. Hope is's possible to understand, what I'm trying to do. If you have any Ideas it would be great! Werner |
#4
|
|||
|
|||
![]()
I think that it would be better refuse from copy/paste operations via the clipboard.
|
#5
|
|||
|
|||
![]()
Hi Shark
may be that it would be better, but these Shapes are created in Excel, because there is the Main-Makro-Construct, wich does a lot of the Work I need. And when these Shapes are created I see no other solution except Copy/Paste.. ![]() |
#6
|
|||
|
|||
![]()
I have macro that arranges shapes to each other end to end (without gaps) but you have a text-shapes which must be grouped with rectangles. And then all this shapes will be "organized"
|
#7
|
|||
|
|||
![]()
Hi Shark
thank you for your intensiv afford! I will see, if I can change my Macro to Group these Shapes (Text with Rectangles) but I see a Problem there: My Macro ungroups the Shapes, that came out of the Clipboard from Excel, because I have to change the Linethickness to hairline (unfortunately Excel can't produce Hairlines and I need them to work with). I have to try to ungroup the Textshapes, then change the Linethickness and then to group them again. After this it would be very helpfull to see your Macro to arrange them end to end, without a Gap. I will post again, if this 'work is done'. |
#8
|
|||
|
|||
![]()
Hi
By the way, you can do it without Ugroup/Group-actions. If you pasting from clipboard all this shapes and they are already grouped then you can change rectangle's thickness directly from Group-shape. If your group-shapes consists of two shapes - rectangle and text - then you can write this: 'For example, s = one of pasted shapes s.Shapes.FindShape(, cdrRectangleShape).Outline.Width = 0.01 ' change thickness of the rectangle found inside the group to 0.01 /mm or pixels or any measure unit/ If your rectangle is curved rectangle then change cdrRectangleShape to cdrCurveShape Last edited by shark; 10-03-2017 at 07:11. |
#9
|
|||
|
|||
![]()
Hello Shark
this sounds like a very, very good Idea, because it would make my Code much more effectiv. But I don't realy understand where in my Code this new Part could be placed. Even it may be a problem that that, what I paste is a Group of up to 40 Shapes within Text. I dont' know if VBA finds the rectangelshapes in a group of many shapes with each has text in it. My Code ist: Code:
Option Explicit Sub Thor_o_Mat() Dim shp As Shape, SB As Double, SH As Double Dim OrigSelection As ShapeRange Dim PY As Double, PX As Double ActiveDocument.BeginCommandGroup "Schilder" Optimization = True EventsEnabled = False ActiveDocument.SaveSettings ActiveDocument.PreserveSelection = False ActiveLayer.Paste Set OrigSelection = ActiveSelectionRange ' ActiveSelection.Ungroup For Each shp In ActivePage.Shapes '******************************* shp.Shapes.FindShape(, cdrRectangleShape).Outline.Width = 0.003 '************************* Would this be the right place???? If shp.Type = 3 Then SB = Round((shp.SizeWidth * 2.54), 0) SH = Round((shp.SizeHeight * 2.54), 0) SB = SB / 2.54 + 0.005 SH = SH / 2.54 + 0.005 shp.Fill.ApplyNoFill 'PX = shp.PositionX 'PY = shp.PositionY With shp .SizeHeight = SH .SizeWidth = SB ' .PositionX = PX - 0.02 ' .PositionY = PY + 0.02 .Outline.Type = cdrOutline .Outline.Width = 0.003 .Outline.Color.RGBAssign 255, 0, 0 End With End If Next shp ActiveDocument.PreserveSelection = True ActiveDocument.RestoreSettings EventsEnabled = True Optimization = False ActiveDocument.EndCommandGroup ActiveWindow.Refresh Application.Refresh End Sub (The following Code is, what I used to change Linethickness) Sorry but my VBA isn't very advanced. Can you help again? Last edited by WernerHo; 11-03-2017 at 07:30. |
#10
|
|||
|
|||
![]()
Hi, WernerHo
Could you upload work .xls-file with some shapes and text, that you then copyng to clipboard and paste to CorelDraw? I will try to improve your code |
![]() |
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 |
Loop thru shapes and break at nodes | nic | CorelDRAW/Corel DESIGNER VBA | 5 | 13-03-2016 05:58 |
Nodes | Val Costanzo | General | 4 | 25-09-2008 05:46 |
VBA Nodes Tutorial | Sablesword | CorelDRAW/Corel DESIGNER VBA | 1 | 23-09-2008 21:01 |
How can I catch the OnClose event? | Elie | CorelDRAW CS | 2 | 01-04-2004 00:20 |
Too many nodes | ddonnahoe | CorelDRAW/Corel DESIGNER VBA | 3 | 27-02-2004 07:14 |