OberonPlace.com Forums  

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

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

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

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

OK.
I slightly improved your code:
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.SaveSettings
    ActiveDocument.PreserveSelection = False
    
    ActiveLayer.Paste
    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
            .Fill.ApplyNoFill
'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
    'ActiveDocument.RestoreSettings
    EventsEnabled = True
    Optimization = False
    ActiveDocument.EndCommandGroup
    ActiveWindow.Refresh
    Application.Refresh
End Sub
To arrange objects you can take my old macros
https://forum.oberonplace.com/showthread.php?t=7563
or modify this code
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
    ActiveDocument.EndCommandGroup
End Sub

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

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!!
Regards
Werner
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
Loop thru shapes and break at nodes nic CorelDRAW/Corel DESIGNER VBA 5 13-03-2016 06:58
Nodes Val Costanzo General 4 25-09-2008 06:46
VBA Nodes Tutorial Sablesword CorelDRAW/Corel DESIGNER VBA 1 23-09-2008 22:01
How can I catch the OnClose event? Elie CorelDRAW CS 2 01-04-2004 01:20
Too many nodes ddonnahoe CorelDRAW/Corel DESIGNER VBA 3 27-02-2004 08:14


All times are GMT -5. The time now is 04:02.


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