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 18-05-2007, 22:04
knowbodynow knowbodynow is offline
Senior Member
 
Join Date: Mar 2006
Location: Hatsukaichi near Hiroshima
Posts: 434
Default Problem moving objects to master layer

Hello, I have the following code to move selected objects to the active layer:

Code:
Sub MoveShapesToCurrentLayer()

Dim sr As New ShapeRange

If Not ActiveShape Is Nothing Then
      sr.AddRange ActiveSelectionRange
      sr.MoveToLayer ActiveLayer
End If

End Sub
This works fine, except if the active layer is a master layer the selected object becomes invisible and remains that way even if I refresh the screen. Have I done something wrong or is this a bug? I'm using CorelDraw 12 with SP1.

Thanks,

Chris (Hunt)
Reply With Quote
  #2  
Old 19-05-2007, 08:57
Manuel
Guest
 
Posts: n/a
Default

I tried it and it moves the selection to limbo land, strange. They show up on the object manager above all layers but not inside any layer.

This code works though:

Code:
Sub MoveToActiveLayer()

    If ActiveSelection.Shapes.Count = 0 Then
    MsgBox "Nothing Selected", vbOKOnly, "Warning": Exit Sub
    Else
    ActiveSelection.Copy: ActiveLayer.Paste
    End If

End Sub
Reply With Quote
  #3  
Old 23-05-2007, 18:33
knowbodynow knowbodynow is offline
Senior Member
 
Join Date: Mar 2006
Location: Hatsukaichi near Hiroshima
Posts: 434
Default

Thanks for the reply, I guess it must be a bug. Here is the code I end up with that borrows from your idea:

Code:
Sub MoveShapesToCurrentLayer()

Dim sr As New ShapeRange

If Not ActiveShape Is Nothing Then

    sr.AddRange ActiveSelectionRange
      
    If ActiveLayer.Master = False Then
      
      sr.MoveToLayer ActiveLayer
      
    Else
    
    ActiveSelection.Copy: ActiveLayer.Paste
    sr.Delete
          
    End If
    
End If
    
End Sub
I added a line to delete the original after copying to the masterlayer.

Thanks again,

Chris
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
Copy Selected Objects to other pages maintaining layers knowbodynow Code Critique 6 13-12-2015 18:46
Move objects to selected layer (either "a" or "b") 6fazer CorelDRAW/Corel DESIGNER VBA 3 07-03-2007 19:10
Count objects in active selection on master layer knowbodynow CorelDRAW/Corel DESIGNER VBA 7 27-02-2007 21:48
::LayerControl:: macro for FAST layer management in CorelDraw wOxxOm CorelDRAW/Corel DESIGNER VBA 0 10-05-2006 11:40
VBA help needed - changing colours fremoikaner CorelDRAW/Corel DESIGNER VBA 1 18-11-2004 06:06


All times are GMT -5. The time now is 03:47.


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