OberonPlace.com Forums  

Go Back   OberonPlace.com Forums > Developer Forums > VBA > CorelDRAW/Corel DESIGNER VBA

Thread Tools Search this Thread Display Modes
Old 13-03-2017, 12:24
WernerHo WernerHo is offline
Junior Member
Join Date: Jan 2008
Posts: 20

Hi Shark
I don't think, that you have the time to analyze the complete thing, because there is much different work in it.
I tried to upload a xlsm, but it dindn't work, because it's "not a valid file"...

Don't worry, I will get further with the tipps you gave 'til now.
Thanks a lot!!

Last edited by WernerHo; 13-03-2017 at 12:39.
Reply With Quote
Old 13-03-2017, 14:37
shark shark is offline
Senior Member
Join Date: Aug 2010
Location: Russia, Belgorod
Posts: 146

I slightly improved your code:
Sub Thor_o_Mat()
Dim shp As Shape, SB As Double, SH As Double, sC As Shape
Dim OrigSelection As ShapeRange
Dim PY As Double, PX As Double
    ActiveDocument.BeginCommandGroup "Schilder"
    Optimization = True
    EventsEnabled = False
    ActiveDocument.PreserveSelection = False
    Set OrigSelection = ActiveSelectionRange

    For Each shp In OrigSelection
    Set sC = shp.Shapes.FindShape(, cdrCurveShape) 'Find curved rectangle in group-shape. Or not rectangle
    If Not sC Is Nothing Then
        With sC
            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
'PX = shp.PositionX
'PY = shp.PositionY

            .SizeHeight = SH
            .SizeWidth = SB
'        .PositionX = PX - 0.02
'        .PositionY = PY + 0.02
            .Outline.SetProperties 0.003, , CreateRGBColor(255, 0, 0)
        End With
    End If

    Next shp
    ActiveDocument.PreserveSelection = True
    EventsEnabled = True
    Optimization = False
End Sub
To arrange objects you can take my old macros
or modify this code
Sub ArrangeRight() 'Places shapes one after another left-to right
    Dim sr As ShapeRange
    Dim cnt%, x#, y#, w#, H#
    Set sr = ActiveSelectionRange
    If sr.Count < 2 Then Exit Sub
    ActiveDocument.ReferencePoint = cdrTopLeft
    ActiveDocument.Unit = cdrMillimeter

    ActiveDocument.BeginCommandGroup "Arrange_right"
    For cnt = 2 To sr.Count
        sr(cnt - 1).GetBoundingBox x, y, w, H, True
        sr(cnt).SetPosition x + w, y + H
    Next cnt
End Sub

Last edited by shark; 14-03-2017 at 02:39. Reason: remove ' from Activelayer.Paste
Reply With Quote
Old 13-03-2017, 16:00
WernerHo WernerHo is offline
Junior Member
Join Date: Jan 2008
Posts: 20

Hello Shark
many, many thanks for your effort!!
I will look at this code an your Macro as soon as possible.
If I get it all to work I will give you a Feedback.
Thank you so much!!
Reply With Quote

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
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

All times are GMT -5. The time now is 05:36.

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