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 19-10-2011, 01:07
noj noj is offline
Member
 
Join Date: Oct 2011
Location: Sydney
Posts: 31
Default Do...loop error

Hi,
Can anyone tell me why I'm getting the Runtime Error '91' "Object variable or With block variable not set" which comes up right at the end of running this code? The line in blue is the issue.

Sub Random()
Dim bulbs As ShapeRange
Set bulbs = ActiveSelectionRange
Dim Num As Integer
Num = 1
Counter = 1
Do Until Counter = bulbs.Count
With bulbs(Num).Fill
.ApplyUniformFill CreateRGBColor(255, 0, 0)
Num = Num + Int((3 * Rnd) + 2)
Counter = Counter + 1
End With
Loop
End Sub

Last edited by noj; 19-10-2011 at 01:10.
Reply With Quote
  #2  
Old 19-10-2011, 01:26
noj noj is offline
Member
 
Join Date: Oct 2011
Location: Sydney
Posts: 31
Default

Never mind. I fixed it with an If Then statement. I think the code was referencing a shape that didn't exist at the end.
Reply With Quote
  #3  
Old 19-10-2011, 09:25
runflacruiser's Avatar
runflacruiser runflacruiser is offline
Senior Member
 
Join Date: Jun 2009
Location: Pigeon Forge, TN USA
Posts: 811
Default

Hi.
Yea... Looks like nothing was selected so the shaperange index wasn't set to a shape.
~John
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
Can't loop thru layers xxxslowjoe CorelDRAW/Corel DESIGNER VBA 1 06-06-2009 12:52
Simple Loop? dan CorelDRAW/Corel DESIGNER VBA 3 13-10-2004 13:31


All times are GMT -5. The time now is 11:10.


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