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 06-06-2009, 12:58
xxxslowjoe
Guest
 
Posts: n/a
Default Can't loop thru layers

Hi,

I am new to VBA programming and probably only an average CorelDRAW user. I recently bought the Corel X4 Suite. I am trying to automate some tasks and am taking baby steps.

I need to loop through all the layers of the master page. Below are two methods - the second works while the first does not. I would prefer the first method. I get an error (run time error 91 - Object variable or With block variable not set) and I can see "l" is Nothing in the stack window. Any help would be appreciated.


Dim l as Layer
Dim currIdx As Integer

For currIdx = 1 To ActiveDocument.MasterPage.Layers.Count Step 1
l = ActiveDocument.MasterPage.Layers.Item(currIdx) 'error 91 here
Debug.Print "Layer name = " & l.Name
Next currIdx

For Each l In ActiveDocument.MasterPage.Layers
Debug.Print "Header name = " & l.Name
Next l

Thank you,
Joe
Reply With Quote
  #2  
Old 06-06-2009, 13:52
xxxslowjoe
Guest
 
Posts: n/a
Default

I think I figured it out:

For currIdx = 1 To ActiveDocument.MasterPage.Layers.Count Step 1
Set l = ActiveDocument.MasterPage.Layers(currIdx)
Debug.Print "Layer name = " & l.Name
Next currIdx

Joe
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
Layers in Corel X3 Sally General 2 15-03-2007 17:39
layers signweld General 2 09-03-2007 13:40
How controll lot of layers? petig CorelDRAW/Corel DESIGNER VBA 5 28-08-2005 03:35
Simple Loop? dan CorelDRAW/Corel DESIGNER VBA 3 13-10-2004 14:31
Send to layers click101 CorelDRAW/Corel DESIGNER VBA 4 14-09-2004 03:46


All times are GMT -5. The time now is 13:16.


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