OberonPlace.com Forums  

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

Thread Tools Search this Thread Display Modes
Old 04-05-2007, 20:35
knowbodynow knowbodynow is offline
Senior Member
Join Date: Mar 2006
Location: Hatsukaichi near Hiroshima
Posts: 434
Default Problem with positioning a duplicate


Is the following code OK? I'm trying to create a duplicate that aligns to another object.

Sub duptoVposition()

Dim s1 As Shape
Dim y1 As Double, y2 As Double
Dim setrevoffset As String

ActiveDocument.Unit = cdrMillimeter

If ActiveDocument Is Nothing Then End
If ActiveSelection.Shapes.Count = 2 Then

    y1 = ActiveSelection.Shapes(1).PositionY
    y2 = ActiveSelection.Shapes(2).PositionY

    setrevoffset = y2 - y1

    Set s1 = ActiveSelection.Shapes(1).Duplicate(, setrevoffset)

End If

End Sub
CorelDraw is currently duplicating the object way off the page and I don't know why.


Chris (Hunt)
Reply With Quote
Old 05-05-2007, 06:14
wOxxOm's Avatar
wOxxOm wOxxOm is offline
Senior Member
Join Date: Mar 2005
Posts: 836

your code is working ok here.
I guess the problem might be in Page XY Origin location. Is it default left bottom corner?
Reply With Quote
Old 05-05-2007, 08:55
Posts: n/a
Default Re: Positioning a duplicate

Hi I'm new, both to this forum and to VBA. So bear with me if I ask rookie (stupid) questions.

1. The macro works for me. It aligns to the top of the "anchor" object

2. Now the questions: why is "setrevoffset" set As String instead of Double?
is the top a default reference point since none was specified?
Reply With Quote
Old 05-05-2007, 09:09
wOxxOm's Avatar
wOxxOm wOxxOm is offline
Senior Member
Join Date: Mar 2005
Posts: 836

1. it works this way too but slower :-) declare as double is of course would be more logical :-)
2. I dunno frankly what can be the cause of malfunction, so that was just a desperate guess
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
Selected object to other page Duplicate method ? ljesus7 CorelDRAW/Corel DESIGNER VBA 5 12-02-2007 16:37
Querious Problem. amollondhe CorelDRAW/Corel DESIGNER VBA 1 31-03-2006 08:40
CD11 Convert to Bitmap -> CMYK to Gray scale problem xenio General 7 24-07-2005 21:46
a problem... CorelUser General 2 20-06-2004 02:21
Problem with Export (or Save as) in AI-Format LOT CorelDRAW/Corel DESIGNER VBA 3 10-02-2004 14:28

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

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