OberonPlace.com Forums  

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

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 27-12-2007, 12:45
zxy050
Guest
 
Posts: n/a
Default get the OrigSelection's width and height

problem:

Private Sub CommandButton3_Click()
Dim OrigSelection As ShapeRange
10 a = 148.5
20 b = TextBox3.Value
c = TextBox5.Value / 2
Y = (b - a - c - 0.1) / 2
d = 105
e = TextBox9.Value
f = TextBox4.Value / 2
If OptionButton1.Value = True Then
X = (e - d - f - 0.055) / 2
Else
X = (e - d + f + 0.1) / 2
End If
Set OrigSelection = ActiveSelectionRange
OrigSelection.Cut
ActiveLayer.Paste
Dim Paste1 As ShapeRange
Set Paste1 = ActiveSelectionRange
Paste1.Move 0.078740157480315 * X, 0.078740157480315 * Y
ActiveDocument.ReferencePoint = cdrTopMiddle
MsgBox "OK"
End
End Sub

I want to get the OrigSelection's width and height ,but i test many times,
example "x=origselection.Topy;y=origselection.Bottomy;wheight=y-x;print wheight" but the value is different with the origselection.
help,help
wait online,thanks
Reply With Quote
  #2  
Old 27-12-2007, 23:59
vindaa
Guest
 
Posts: n/a
Default What do you want to achieve

Actuall what do you want to be done ?
Reply With Quote
  #3  
Old 28-12-2007, 05:48
wOxxOm's Avatar
wOxxOm wOxxOm is offline
Senior Member
 
Join Date: Mar 2005
Posts: 836
Default

Paste selects only the last object if multiple objects were being operated upon. What a beep-beep-beep!
Feel free to re-use the code below:
Code:
Sub PasteMe()
   Dim cnt&, i&, sr As ShapeRange
   
   cnt = ActiveLayer.shapes.Count
   ActiveDocument.BeginCommandGroup "Paste  at mouse"
   ActiveLayer.Paste
   If cnt <> ActiveLayer.shapes.Count Then
      Set sr = New ShapeRange
      For i = 1 To ActiveLayer.shapes.Count - cnt
         sr.Add ActiveLayer.shapes(i)
      Next
      sr.SetPosition x, y
      End If
   ActiveDocument.EndCommandGroup
   End Sub
Or just group the objects before copying, and ungroup after pasting.

P.S. You might want to use instead of that:
Code:
Set OrigSelection = ActiveSelectionRange
OrigSelection.Cut
ActiveLayer.Paste
Dim Paste1 As ShapeRange
Set Paste1 = ActiveSelectionRange
Paste1.Move 0.078740157480315 * X, 0.078740157480315 * Y
just this
Code:
ActiveSelectionRange.Move 0.078740157480315 * X, 0.078740157480315 * Y
ActiveSelectionRange.MoveToLayer ActiveLayer

Last edited by wOxxOm; 28-12-2007 at 06:01.
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
Sending document size to printer tacarey CorelDRAW/Corel DESIGNER VBA 5 16-05-2008 02:09
Problem with VBA in Draw X3 LGD CorelDRAW/Corel DESIGNER VBA 8 19-01-2006 10:14


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


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